2017-06-05 38 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」