为什么我的domdocument代码不起作用?

时间:2017-03-14 09:07:08

标签: php laravel dom

我试图做一些错误处理,但它不起作用。

foreach ($meta as $node) {
        if($node->getAttribute('name')=='description' && $node->getAttribute('content') > 0) {
            $ts->description = $node->getAttribute('content');
        }
        else {
            $ts->description = 'No description found';
        }
    }

这不起作用..它无法找到正确的元标记。它不是为描述找到元标记,而是找到<meta name="viewport" content="width=device-width,initial-scale=1">

宣言$ ts:

$ts = new Scan;

$ts->save();

将其保存到Laravel中的数据库。

0 个答案:

没有答案
相关问题