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 に答える