[英]PHP Fatal error: Uncaught Error: Call to undefined function getheaders()
when I run my code I get this error 当我运行我的代码时,我得到了这个错误
PHP Warning: log() expects parameter 1 to be float, string given in /opt/lampp/htdocs/x/websocket/server.php on line 2 PHP Fatal error: Uncaught Error: Call to undefined function getheaders() PHP警告:log()期望参数1为float,第2行上的/opt/lampp/htdocs/x/websocket/server.php中给出的字符串PHP致命错误:未捕获错误:调用未定义函数getheaders()
my code 我的代码
<?php
log("Handshaking...");
list($resource,$host,$origin) = getheaders($buffer);
$upgrade = "HTTP/1.1 101 Web Socket Protocol Handshake\r\n" .
"Upgrade: WebSocket\r\n" .
"Connection: Upgrade\r\n" .
"WebSocket-Origin: " . $origin . "\r\n" .
"WebSocket-Location: ws://" . $host . $resource . "\r\n" .
"\r\n";
$handshake = true;
socket_write($socket,$upgrade.chr(0),strlen($upgrade.chr(0)));
what's the wrong ? 怎么了?
Look at the doc: http://php.net/manual/en/function.log.php log is not for "Logs". 查看文档: http : //php.net/manual/en/function.log.php日志不适用于“日志”。
Try with file_put_contents(). 尝试使用file_put_contents()。
for getheaders() the correct syntax is "get_headers()" 对于getheaders(),正确的语法是“get_headers()”
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.