变量未存储在数组中

时间:2013-11-06 16:55:05

标签: php arrays variables store

我有以下内容根据网址检查关键字列表:

function searchUrls()
{
    $result = array();

    $urlList = file("link_to.txt");
    $keywordList = explode("\n", file_get_contents("link_to.txt"));

    for($index = 0; $index <count($urlList); $index++)  
    {  
        $urlList[$index] = str_replace("\n", "", $urlList[$index]);  
        $data = file_get_contents("$urlList[$index]"); 

        $keywords = array();
        foreach($keywordList as $keyword)
        {  
            if (stripos($data, $keyword) !== false) 
            {
                $keywords[] = $Keyword.'found';
            } 
        }
        $result[] = array('url' => $urlList[$index], 'status' => $keywords);
    }  
return $result;
}
当回声时,

foreach($result['status'] as $keyword)

只有'found'正在打印。

var_dump($results) 变量不存储在数组中,但文本是?

如何回应变量和文本?

非常感谢

0 个答案:

没有答案