我有一個文本文件名爲1month.ssh
:警告:語法錯誤,意想不到的BOOL_TRUE
Host: m-sg5.portssh.com
Username: portssh.com-myuser
Password: mypass
Port: 443
Info: Your Account will expire on 02-January-2017
我試圖根據與該文件創建一個數組:
$infossh = parse_ini_string(preg_replace('/^([^:]+): (.+)$/m','$1 = $2',file_get_contents('/home/ab/gconf/'.$_POST['account'])));
$_POST['account']
指1month.ssh
。我的目標是當我呼應陣列,每個值應該是這樣的:
$infossh['Host'] = "m-sg5.portssh.com"
$infossh['Username'] = "portssh.com-myuser"
$infossh['Password'] = "mypass"
$infossh['Port'] = "443"
$infossh['Info'] = "Your Account will expire on 02-January-2017"
而是使用代碼我得到以下錯誤:
Warning: syntax error, unexpected BOOL_TRUE in Unknown on line 5 in /www/ssh.php on line 218
我該如何解決這個問題?
附加信息:
我有另外一個文件sgdo.ssh
:
Host: x-sgdo19.serverip.co
Username: fastssh.com-myuser
Password: mypass
Port: 443
Info: Date Expired : 10-December-2016
,但我得到這個文件中沒有錯誤,錯誤,當我打開只發生1month.ssh
你在同一個文件中有多個'Host'? – Perumal
@ Perumal93不僅一個sgdo.ssh和1month.ssh是兩個不同的文件 – hillz
我的意思是這些五行重複爲同一個文件中的每個主機?你有我的觀點? – Perumal