我尝试构建一个函数保存所有错误 这是我的例子:
<?php
$stid = oci_parse($conn, "select does_not_exist from dual");
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid); // For oci_execute errors pass the statement handle
print htmlentities($e['message']);
print "\n<pre>\n";
print htmlentities($e['sqltext']);
printf("\n%".($e['offset']+1)."s", "^");
print "\n</pre>\n";
}
?>
function error($r, $stid){
if(!$r){
$error = oci_error($stid);
$code = "Code"." ".$error["code"];
$sql = "Sql Statment"." ".$error["sqltext"];
$Position = "Position"." ".$error["offset"];
$message = "Message"." ".$error["message"];
$all = array("code"=>$code, "sql"=>$sql, "Position"=>$Position, "message"=>$message);
return($all);
}
我想要BT喜欢这个
$stid = oci_parse($conn, "select does_not_exist from dual");
$r = oci_execute($stid);
$error = error($r, $stid);
echo $error["message"];
echo $error["sql"];
echo $error["code"];
echo $error["Position"];
但它不起作用 _ 请帮助做到