Jump to content
php.lv forumi

Recommended Posts

Posted

pienjemsim ka man ir strings

$str="Mana mīlākā mājas lapa <a href=\"http://www.php.lv\">http://www.php.lv</a> un lapas forums atrodās <a href=\"http://www.php.lv/f\">http://www.php.lv/f</a> nāciet ciemos.";

Kā lai es dabūnu pieņemsim šādu tekstu

$str="Mana mīlākā mājas lapa <u>http://www.php.lv</u> un lapas forums atrodās <u>http://www.php.lv/f</u> nāciet ciemos.";

Posted

izmantoju sekojosho kodu bet man nesanaca ta vai ta..

 

						  $htmlbody = str_replace("<a href=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody);
					  $htmlbody = str_replace("title=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody);
					  $htmlbody = str_replace("class=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody);
					  $htmlbody = str_replace("id=\"/[^a-zA-Z0-9s]/\"", "", $htmlbody);
					  $htmlbody = str_replace("target=\"_blank\">", "", $htmlbody);
					  $htmlbody = str_replace("</a>", "", $htmlbody);

Posted

pats atrisinaju savu problemu

 

ja nu akdam vaig

$str = str_replace('</a>', '', $str);
$str = preg_replace('/<a[^>]+href[^>]+>/', '', $str);

Guest
This topic is now closed to further replies.
×
×
  • Create New...