这句话啥意思 stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
小弟是做客户端的,php啥也不懂。
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem'); 这句话是神马意思,希望大神解释。
还有同样的功能能用myeclipse实现吗?谢谢!
完整的如下。
$message,
'sound' => 'default'
);
// encode the payload as json
$payload = json_encode($body);
// build the binary notification
$msg = chr(0) . pack('n', 32) . pack('h*', $devicetoken) . pack('n', strlen($payload)) . $payload;
// send it to the server
$result = fwrite($fp, $msg, strlen($msg));
if (!$result)
echo 'message not delivered' . php_eol;
else
echo 'message successfully delivered' . php_eol;
// close the connection to the server
fclose($fp);
------解决方案--------------------
stream_context_set_option($ctx, 'ssl', 'local_cert', 'ck.pem');
这句是说对于ctx这个socket连接,使用ssl协议,使用本地授权证书,使用ck.pem作为授权证书
eclipse是ide啊
php始终需要php环境执行的