assert_options函数 设置断言的参数
assert 函数 ,检测一个断言
<?php // 激活断言,并设置它为 quiet assert_options(ASSERT_ACTIVE, 1); assert_options(ASSERT_WARNING, 0); assert_options(ASSERT_QUIET_EVAL, 1); // 设置回调函数 assert_options(ASSERT_CALLBACK, ‘my_assert_handler‘); // 让一则断言失败 assert(‘mysql_query("")‘); //创建处理函数 function my_assert_handler($file, $line, $code) { echo "error: File ‘$file‘ Line ‘$line‘ Code ‘$code‘"; }
原文地址:https://www.cnblogs.com/taoshihan/p/10531744.html
时间: 2024-10-05 07:54:08