[PHP] assert()断言检测函数
发布时间:2021-05-21 06:50:22 所属栏目:大数据 来源: https://www.jb51.cc
导读:assert_options函数 设置断言的参数 assert 函数,检测一个断言 ?PHP// 激活断言,并设置它为 quietassert_options(ASSERT_ACTIVE,1);assert_options(ASSERT_WARNING,0);assert_options(ASSERT_QUIET_EVAL,1);// 设置回调函数assert_options(ASSERT_CALLBACK,
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'"; } ?
(编辑:北几岛) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |