2

I have a custom ini file with configurations (does not refer to php ini file) and i need to check it's syntax. Found a function parse_ini_file which parses the file, but it generates warning if file is bad, may be there is some function to check if before parse?

4

1 回答 1

3

正如我的评论所预期的那样,我会这样做:

function valid_ini_file($path) {
  return @parse_ini_file($path) !== false;
}

简洁明了。

于 2013-07-10T12:01:56.100 回答