我很想为这个小问题提供一些帮助。
我需要 PHP 来收集 HTML。可以说,这是完整 HTML 代码的一部分:
<div class="inner">
<p>Hi there. I am text! I'm playing hide and seek with PHP.</p>
</div>
我的目标是收集 和 之间的所有<p>
内容</p>
。这是我到目前为止的PHP:
$file = file_get_contents($link); //Import le HTML
preg_match('<div class="inner">
<p>(.*?)</p>
</div>si', $file, $k); //Play find & seek
$k_out = $k[1];
$name = strtok($k , '#'); //Remove everything behind the hashtags
echo $name;
但是 - 可悲的是 - PHP 错误了我:
*警告:preg_match():第 131 行 /home/fourwonders/alexstuff/vinedownloader/public_html/v/index.php 中的未知修饰符“<”*
你能帮我吗?至少,感谢您的阅读!