检测资源类型的问题(mysqli和pdo) 在PHP里该如何检测一个变量是 mysqli和pdo对象,明确地知道。我知道可能用get_resource_type来获取mysql_connect和其它一些类型,可是用在mysqli和pdo上报错,如下。Supplied argument is not a valid resource handle 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 get_resource_type(PHP 4 >= 4.0.2, PHP 5)get_resource_type — 返回资源(resource)类型 描述string get_resource_type ( resource $handle )此函数返回一个字符串,用于表示传递给它的 resource 的类型。如果参数不是合法的 resource,将产生错误。 <?php$c = mysql_connect();echo get_resource_type($c)."\n";// 打印:mysql link$fp = fopen("foo","w");echo get_resource_type($fp)."\n";// 打印:file$doc = new_xmldoc("1.0");echo get_resource_type($doc->doc)."\n";// 打印:domxml document?> Supplied argument is not a valid resource handle表明你传入的参数不是一个初始化成功的对象建议检查一下数据库IP,用户名和密码是否正确 我用了AJAX,用了之后怎么测试php输出结果呢 求教一个PHP赋值判断的问题 求教如何在eclipse中调试DeDeCMS 系统? PHP的时间问题 求高手帮忙啊,显示字符串长度失败 PHP可不可以象ASP那样直接连接Access数据库? 请交:谁手头有验证输入内容是否为数字的JS FUNCTION 请问如何让PHP连接文件型ACCESS数据库? 请问那里下载最新版本的PHP中文手册? PHP 从数据库返回值时 checkbox被选中 用PHP、Mysql写网页一定要用到XML吗? iis+php+win2003配置问题
(PHP 4 >= 4.0.2, PHP 5)get_resource_type — 返回资源(resource)类型 描述
string get_resource_type ( resource $handle )
此函数返回一个字符串,用于表示传递给它的 resource 的类型。如果参数不是合法的 resource,将产生错误。 <?php
$c = mysql_connect();
echo get_resource_type($c)."\n";
// 打印:mysql link$fp = fopen("foo","w");
echo get_resource_type($fp)."\n";
// 打印:file$doc = new_xmldoc("1.0");
echo get_resource_type($doc->doc)."\n";
// 打印:domxml document
?>