超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<get_defined_varsgettype>
Last updated: Fri, 22 Jun 2007

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
?>




add a note add a note User Contributed Notes
get_resource_type
ian@eiloart.comNO_SPAM
18-Jul-2001 12:31
also returns an error if you pass it an ldap link identifier, which is a resource. Careful.
nachof@internet.com.uyNOSPAMPLEASE
17-Oct-2001 04:29
In the page that describes the resurce data type, there is a comment posted that says that ldap-connect does not return a resource, as it might be expected, but an integer. That would be the reason that you get an error when using get_resource_type() on a ldap "resource"

<get_defined_varsgettype>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22