Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/233.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
我有一个错误:注意:未定义的偏移量:在C:\wamp\www\index.php的第32行,第34行,第36行,第38行_Php_Mysql - Fatal编程技术网

我有一个错误:注意:未定义的偏移量:在C:\wamp\www\index.php的第32行,第34行,第36行,第38行

我有一个错误:注意:未定义的偏移量:在C:\wamp\www\index.php的第32行,第34行,第36行,第38行,php,mysql,Php,Mysql,从第31行到第38行,当我打开localhost时,它会给出这个错误,localhost的颜色仍然是黄色。我怎样才能把它变成绿色?这是因为配置文件中有空间。 我猜当您在WAMP服务器菜单中选择另一版本的Apache、PHP或MySQL时,它会更改配置文件,但会删除等号后面的空格: mysqlVersion=“5.7.4”应为: mysqlVersion=“5.7.4”这意味着$result[1]不存在(索引1)。通过print\r($result)进行检查是否有索引1?打印的可能重复($resu

从第31行到第38行,当我打开localhost时,它会给出这个错误,localhost的颜色仍然是黄色。我怎样才能把它变成绿色?

这是因为配置文件中有空间。 我猜当您在WAMP服务器菜单中选择另一版本的Apache、PHP或MySQL时,它会更改配置文件,但会删除等号后面的空格: mysqlVersion=“5.7.4”应为:
mysqlVersion=“5.7.4”

这意味着
$result[1]
不存在(索引1)。通过
print\r($result)进行检查是否有索引1?打印的可能重复($result);现在它开始工作了,非常感谢你@AlivetoDie@Dynamo什么在起作用?
preg_match('|phpVersion = (.*)\n|',$wampConfFileContents,$result);
$phpVersion = str_replace('"','',$result[1]);
preg_match('|apacheVersion = (.*)\n|',$wampConfFileContents,$result);
$apacheVersion = str_replace('"','',$result[1]);
preg_match('|mysqlVersion = (.*)\n|',$wampConfFileContents,$result);
$mysqlVersion = str_replace('"','',$result[1]);
preg_match('|wampserverVersion = (.*)\n|',$wampConfFileContents,$result);
$wampserverVersion = str_replace('"','',$result[1]);