PHP 教程 PHP get_resource_type() 函数

jed · 2022-03-09 22:50:58 · 热度: 7

get_resource_type() 返回资源(resource)类型。

版本要求:PHP 4 >= 4.0.2, PHP 5, PHP 7

语法

string get_resource_type ( resource $handle )

参数说明:

  • $handle:句柄。

返回值

此函数返回一个字符串,用于表示传递给它的 resource 的类型。如果参数不是合法的 resource,将产生错误。

实例

实例

<?php $c = mysql_connect(); echo get_resource_type($c) . PHP_EOL; // 打印:mysql link $fp = fopen("foo","w"); echo get_resource_type($fp) . PHP_EOL; // 打印:file $doc = new_xmldoc("1.0"); echo get_resource_type($doc->doc) . PHP_EOL; // 打印:domxml document ?>

查看更多 PHP 可用的函数

猜你喜欢:
暂无回复。
需要 登录 后方可回复, 如果你还没有账号请点击这里 注册