为什么在 $columnArray[]... 行上出现意外的 ']' 错误?
<?php
$con=mysqli_connect("localhost","user","password","test");
if (mysqli_connect_errno($con)) { echo "Failed to connect to MySQL: " . mysqli_connect_error();}
$sql = "SELECT column_comment,column_name FROM information_schema.columns
WHERE table_name = 'mytable';
$query = mysqli_query($con,$sql) or die(mysql_error());
$columnArray = array();
$columnArray = array();
while($result = mysqli_fetch_array($query)){
$columnArray[] = array('column_comment' => $result['column_comment'], 'column_name' => $result['column_name']);
}
PHP 解析错误:语法错误,意外的 ']',需要标识符 (T_STRING) 或变量 (T_VARIABLE) 或数字 (T_NUM_STRING)