[英]PHP static function does not die
class mySql {
static function query($q){
return mysql_query($q)or die(mysql_error());
}
}
class MySql MySql类
echo mySql::query('SELECT * FROM unknown_table');
it must die and display the mysql error but its not. 它必须死并显示mysql错误,但不是。
do static functions really go that way? 静态函数真的会那样吗?
Works for me . 为我工作 。
(basically for the die()
to work, the mysql_query()
needs to return falsy - putting false
there lets me test your short circuit evaluation ). (基本上是为了使
die()
正常工作, mysql_query()
需要返回falsy-在此处设置false
可以测试您的短路评估 )。
Show me your code relevant to your problem, please. 请告诉我您与问题相关的代码。
Does it work with a valid query? 它可以与有效查询一起使用吗?
guess im just stupid 猜我只是愚蠢的
my load_class() function does not load the class properly i forgot to configure my Configuration file and set the base uri to the current folder lol maybe i should delete this one. 我的load_class()函数无法正确加载该类,我忘了配置我的配置文件,并将基本uri设置为当前文件夹,大声笑,也许我应该删除此文件夹。 oh stupidity /facepalm
哦,傻瓜/ facepalm
sorry for bothering everyone xD 很抱歉打扰大家xD
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.