Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
用正则表达式解析 HTML 不是一个好主意。有太多变数会导致事情变得混乱。
尽管如此:
<?php $scrr = "<em>Details</em>I want to <em>get</em>"; preg_match_all('/<em>(.+?)<\/em>/is', $scrr, $match); print_r($match); ?>
如果
<?=$var?>
仅在启用短标签时使用,那么这是否意味着它的常规版本是:
<?php=$var?>
第二个不起作用。