Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/254.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 警告:array_key_exists()要求参数2为array,null_Php - Fatal编程技术网

Php 警告:array_key_exists()要求参数2为array,null

Php 警告:array_key_exists()要求参数2为array,null,php,Php,我是新来的,所以请原谅我的愚蠢,我正在开发一个PHP Web Crawler(),每当我尝试测试它时,它都会给我一个输出,但也会出现以下错误: Warning: array_key_exists() expects parameter 2 to be array, null given in /home/u602323703/public_html/crawler/index.php on line 55 这里是第55行(index.php) 有没有关于如何解决这个问题的建议 PHP代码的全部

我是新来的,所以请原谅我的愚蠢,我正在开发一个PHP Web Crawler(),每当我尝试测试它时,它都会给我一个输出,但也会出现以下错误:

Warning: array_key_exists() expects parameter 2 to be array, null given in /home/u602323703/public_html/crawler/index.php on line 55
这里是第55行(index.php)

有没有关于如何解决这个问题的建议

PHP代码的全部内容:

谢谢, LaffyFX


PS:很抱歉不清楚,等等。因为我不是很擅长,我从www.subinsb.com/how-to-create-a-simple-web-crawler-in-php(不能在atm上发布超过2个链接)

这意味着
$found\u url
不是数组。在测试数组键是否存在之前,您可以检查变量是否是带有
is\u array
函数的数组。另外,您可能需要查看
parse\u url


我也用PHP编写了爬虫程序;最后,我使用了一个完整的类包装器来检查URL是否被访问过。还有另一个工具来验证和规范我看到的URL。

您的代码不足以进行故障排除,$found\u URL设置在哪里?您从哪里获得
$found\u URL
?生成的任何内容都将为null而不是预期的数据
$found\u url
必须是一个数组,显然不像@andrewsi所说的那样。
if($url!='' && substr($url,0,4)!="mail" && substr($url,0,4)!="java" && array_key_exists($enurl,$found_urls)==0){