PHP get_resource_type() Function

PHP 可用的函数PHP Available Functions

get_resource_type()Returns the type of a resource.

Version requirements: PHP 4 >= 4.0.2, PHP 5, PHP 7

Syntax

string get_resource_type ( resource $handle )

Parameter description:

  • $handle: The handle.

Return Value

This function returns a string representing the type of the resource passed to it. If the parameter is not a valid resource, an error will be raised.

Example

Example

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

PHP 可用的函数PHP Available Functions

Other Extensions