Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 打印对账单不';好像不行_Php - Fatal编程技术网

Php 打印对账单不';好像不行

Php 打印对账单不';好像不行,php,Php,我正在构建一个网络爬虫。它可以找到一个页面上的所有链接,以及它们的标题和元描述等。它做得很好。然后我写了一个数组,它给出了我想要的链接的所有起始URL。因此,如果它抓取一个链接,并且它的url以数组中给出起始url的任何值开头,则插入$news\u stories 唯一的问题是它似乎没有插入到它们中。页面返回空白,现在它说array_intersect语句需要一个数组,而我还没有指定我拥有的数组 总之,我很难理解我的代码哪里不起作用,为什么不插入想要的URL $bbc_values = arra

我正在构建一个网络爬虫。它可以找到一个页面上的所有链接,以及它们的标题和元描述等。它做得很好。然后我写了一个数组,它给出了我想要的链接的所有起始URL。因此,如果它抓取一个链接,并且它的url以数组中给出起始url的任何值开头,则插入$news\u stories

唯一的问题是它似乎没有插入到它们中。页面返回空白,现在它说array_intersect语句需要一个数组,而我还没有指定我拥有的数组

总之,我很难理解我的代码哪里不起作用,为什么不插入想要的URL

$bbc_values = array(
    'http://www.bbc.co.uk/news/health-', 
    'http://www.bbc.co.uk/news/politics-', 
    'http://www.bbc.co.uk/news/uk-', 
    'http://www.bbc.co.uk/news/technology-',  
    'http://www.bbc.co.uk/news/england-', 
    'http://www.bbc.co.uk/news/northern_ireland-', 
    'http://www.bbc.co.uk/news/scotland-', 
    'http://www.bbc.co.uk/news/wales-', 
    'http://www.bbc.co.uk/news/business-', 
    'http://www.bbc.co.uk/news/education-', 
    'http://www.bbc.co.uk/news/science_and_enviroment-',         
    'http://www.bbc.co.uk/news/entertainment_and_arts-', 
    'http://edition.cnn.com/'
);

// BBC Algorithm
foreach ($links as $link) {
    $output = array(
        "title"       => Titles($link), //dont know what Titles is, variable or string?
        "description" => getMetas($link),
        "keywords" => getKeywords($link), 
        "link"        => $link                 
    );

    if (empty($output["description"])) {
        $output["description"] = getWord($link);
    }
}

$new_stories = array();

foreach ($output as $new_array) {
    if (array_intersect($output['link'], $bbc_values) == true) {
        $news_stories[] = $new_array;
    }

    print_r($news_stories);
}

将数组贴花为$new\u stories并打印$news\u stories。。。。。差异是“S”

检查代码是否进入这个循环,我认为不是

if (array_intersect($output['link'], $bbc_values) == true) {
    echo 'here';
}

嗯,我不认为数组相交是进行比较所需要的


当使用返回参数时,您可能想在数组中查找,此函数使用内部输出缓冲,因此它不能在ob\u start()回调函数中使用

尝试使用
var\u dump
而不是
print\r
,它提供了一些更有用的信息“print\r不起作用”这是一个荒谬的假设。相信语言,并寻找真正的bug。。