Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 分析错误:语法错误,中出现意外的“{”_Php - Fatal编程技术网

Php 分析错误:语法错误,中出现意外的“{”

Php 分析错误:语法错误,中出现意外的“{”,php,Php,这是我当前的代码: $directory = "polls/"; $dir = opendir($directory); while (($file = readdir($dir)) !== false { $filename = $directory . $file; $type = filetype($filename); if ($type == 'file') { $contents = file_get_contents($filename); $i

这是我当前的代码:

$directory = "polls/";
$dir = opendir($directory);

while (($file = readdir($dir)) !== false {

  $filename = $directory . $file;
  $type = filetype($filename);
  if ($type == 'file') {
     $contents = file_get_contents($filename);
     $items = explode('¬', $contents);
     echo '<table width="500" border="1" cellpadding="4">';
     foreach ($items as $item) {
       echo "<tr><td>$item</td></tr>\n";
     }
     echo '</table>';
  }
}
closedir($dir);
应该是

while (($file = readdir($dir)) !== false) {
while (($file = readdir($dir)) !== false) {

平衡括号:

while (($file = readdir($dir)) !== false) {