Php/docs/function.get-resource-id
来自菜鸟教程
get_resource_id
(PHP 8)
get_resource_id — Returns an integer identifier for the given resource
说明
get_resource_id
( resource $res
) : int
This function provides a type-safe way for generating the integer identifier for a resource.
参数
res
- The evaluated resource handle.
返回值
The int identifier for the given res
.
This function is essentially an int cast of
res
to make it easier to retrieve the resource ID.
范例
Example #1 get_resource_id() example
<?php$handle = fopen('./storage/logs/lumen.log', 'rt');echo (int) $handle . "\n\n";echo get_resource_id($handle);?>
以上例程会输出:
698 698