2017-06-05 35 views
0
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]); 

从线31至线38,我打开本地主机,所以它会给出这个错误,本地主机的颜色仍然是黄色的。我怎样才能获得绿色?我有错误:注意:未定义偏移:1 C:当瓦帕 WWW 的index.php在线路32上,在线路34上,在线路36上,线路38上

+0

这意味着'$ result [1]'不存在(索引1)。通过'print_r($ result);'检查并看到索引1有没有? –

+0

[PHP:“注意:未定义的变量”,“注意:未定义的索引”和“注意:未定义的偏移量”的可能的重复](https://stackoverflow.com/questions/4261133/php-notice-undefined-variable- notice-undefined-index-and-notice-undef) – Exprator

+0

print_r($ result);现在它工作非常感谢你@AlivetoDie – Dynamo

回答

0

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