【发布时间】:2015-07-08 20:05:39
【问题描述】:
我在 Symfony 2 中有这个脚本:
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\DomCrawler\Crawler;
class MyController extends Controller
{
....
foreach($crawler->filter('[type="text/css"]') as $content){
/* make things */
}
foreach($crawler->filter('[rel="stylesheet"]') as $content){
/* make things */
}
¿$crawler->filter 可以接受各种条件并在一个 foreach 中完成吗?例如:
foreach($crawler->filter('[rel="stylesheet"] OR [type="text/css"]') as $content){
/* make things */
}
【问题讨论】:
标签: php symfony domcrawler