Ben aşağıdaki kodu var:
<?php echo strip_tags($firstArticle->introtext); ?>
$ FirstArticle bir stdClass nesnesi olduğunda:
object(stdClass)[422]
public 'link' => string '/maps101/index.php?option=com_content&view=article&id=57:greenlands-newest-iceberg&catid=11:geography-in-the-news' (length=125)
public 'text' => string 'GREENLAND'S NEWEST ICEBERG' (length=26)
public 'introtext' => string '<p>A giant chunk of ice calved off the Petermann Glacier on
the northwest side of Greenland this summer. At nearly 100 square miles (260
sq. km) in size, four times the size of Manhattan, th' (length=206)
public 'date' =>
object(JDate)[423]
public '_date' => int 1284130800
public '_offset' => int 0
public '_errors' =>
array
empty
Sen $ firstArticle-> introtext dize ifade ettiğini görebilirsiniz:
"Buz <p> dev bir yığın bu yaz Grönland kuzeybatı tarafında Petermann Buzulu off calved. Anda yaklaşık 100 mil kare (260 km ²) boyutu, Manhattan'ın dört katı büyüklüğünde, inci"
<p> etiketi ancak strip_tags kesinlikle kaldırmak için reddediyor ve ben neden bilemiyorum, bu uygulama benim için bir sorundur. Aslında strip_tags vazgeçti ve regex / ile yerine preg_replace yapmak için teşebbüs <| * (\ n.)?> /:
preg_replace('/<(.|\n)*?>/', '', $firstArticle->introtext);
Ama bu da işe yaramadı! Ben çıkış yaparken nasıl tüm HTML etiketleri (eşleşen veya değil) bu dizeden şerit olabilir?