代碼如下:
$mysqli=new mysqli("localhost:3307","root","","test");var_dump($mysqli);print_r($mysqli);
回複內容:
代碼如下:
$mysqli=new mysqli("localhost:3307","root","","test");var_dump($mysqli);print_r($mysqli);
$mysqli=new mysqli("localhost:3306","root","","test");
var_export($mysqli);
echo "
";
var_dump($mysqli);
echo "
";
print_r($mysqli);
返回結果為mysqli::__set_state(array( 'affected_rows' => NULL, 'client_info' => NULL, 'client_version' => NULL, 'connect_errno' => NULL, 'connect_error' => NULL, 'errno' => NULL, 'error' => NULL, 'field_count' => NULL, 'host_info' => NULL, 'info' => NULL, 'insert_id' => NULL, 'server_info' => NULL, 'server_version' => NULL, 'stat' => NULL, 'sqlstate' => NULL, 'protocol_version' => NULL, 'thread_id' => NULL, 'warning_count' => NULL, ))
查了下 var_export
var_export必須返回合法的php代碼, 也就是說,var_export返回的代碼,可以直接當作php代碼賦值個一個變數。 而這個變數就會取得和被var_export一樣的類型的值
但是, 當變數類型為resource的時候, 是無法簡單copy複製的,所以, 當var_export的變數是resource類型時, var_export會返回NULL
關於樓主的問題 可能也是類似原因