Note that if the resource parameter is invalid the function will return a boolean with value false.
The code:
$r = null
$cert = stream_context_get_params($r);
var_dump($cert);
will return:
bool(false)
PHP - Manual: stream_context_get_params
2024-11-14
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
stream_context_get_params — Retrieves parameters from a context
$context
): arrayRetrieves parameter and options information from the stream or context.
Returns an associate array containing all context options and parameters.
示例 #1 stream_context_get_params() example
Basic usage example
<?php
$ctx = stream_context_create();
$params = array("notification" => "stream_notification_callback");
stream_context_set_params($ctx, $params);
var_dump(stream_context_get_params($ctx));
?>
以上例程的输出类似于:
array(2) { ["notification"]=> string(28) "stream_notification_callback" ["options"]=> array(0) { } }
Note that if the resource parameter is invalid the function will return a boolean with value false.
The code:
$r = null
$cert = stream_context_get_params($r);
var_dump($cert);
will return:
bool(false)
官方地址:https://www.php.net/manual/en/function.stream-context-get-params.php