解析空行时出现php parse_ini_file错误

时间:2015-07-08 09:27:49

标签: php parsing

我很长时间使用parse_ini_file,但现在它给我发了一个有线错误。

  

的config.ini

[database]
host            = "xxx"
databasename    = xxx
user            = xxx
password        = xxx
typ             = xxx

[sql]
useragentsCountByClicksNoBots   = "SELECT ua.user_agent FROM clicks AS c JOIN user_agents AS ua ON ua.id=c.user_agent_id WHERE ua.is_bot = 0;"
useragentsCountByClicks         = "SELECT ua.user_agent FROM clicks AS c JOIN user_agents AS ua ON ua.id=c.user_agent_id;"

targetCountByClicksNoBots       = "SELECT t.url FROM clicks AS c JOIN target AS t ON t.id=c.target_id JOIN user_agents AS ua ON ua.id=c.user_agent_id WHERE ua.is_bot = 0;"
targetCountByClicks             = "SELECT t.url FROM clicks AS c JOIN target AS t ON t.id=t.target_id;"

[views]
Useragents[title]               = "Useragent"

Useragents[description]         = "Benutzte Browser in denen der Link    geklickt wurde"
Useragents[sql][bots]           = "SELECT ua.user_agent as name FROM clicks AS c JOIN user_agents AS ua ON ua.id=c.user_agent_id;"
Useragents[sql][noBots]         = "SELECT ua.user_agent as name FROM clicks AS c JOIN user_agents AS ua ON ua.id=c.user_agent_id WHERE ua.is_bot = 0;"

target[name]                    = "Target"
target[description]             = "Zielseite für den Link der geklickt wurde"
target[sql][bots]               = "SELECT t.url as name FROM clicks AS c JOIN target AS t ON t.id=c.target_id;"
target[sql][noBots]             = "SELECT t.url as name FROM clicks AS c JOIN target AS t ON t.id=c.target_id JOIN user_agents AS ua ON ua.id=c.user_agent_id WHERE ua.is_bot = 0;"

refferer[name]                  = "Refferer"
refferer[description]           = "Seiten auf denen der Link geklickt wurde"
refferer[sql][bots]             = "SELECT r.refferer as name FROM clicks AS c JOIN refferer AS r ON r.id=c.refferer_id;"
refferer[sql][noBots]           = "SELECT r.refferer as name FROM clicks AS c JOIN refferer AS r ON r.id=c.refferer_id JOIN user_agents AS ua ON ua.id=c.user_agent_id WHERE ua.is_bot = 0;"
  

PHP警告:在第17行解析错误...

但是你看,第17行是空的。 我错过了什么?

1 个答案:

答案 0 :(得分:0)

parse_ini_file不支持ini文件中的N级多维数组。

请参阅php文档中的this answer,了解如何实现此