PHP 读取ini配置报错syntax error, unexpected ‘=‘ in
报错信息
Warning: syntax error, unexpected '=' in src/web/../conf/config.ini on line 12
原因
[start_url]
site1=https://baidu.net/home.php?mod=space&uid=0000&do=thread&view=333333
site2=https://google.com/forum.php?mo=111
因为start_url里面是网址,必须加引号PHP才不会报错,但使用 Python读取完全没问题。
解决办法
读取的时候加入参数 INI_SCANNER_RAW
$file = __DIR__ . "/../conf/config.ini";
$config = parse_ini_file($file, true, INI_SCANNER_RAW);
还没有评论,来说两句吧...