Php 文件\u get\u内容挂起,但我设置了超时参数
我发现了一个奇怪的问题。这是我的php问题代码Php 文件\u get\u内容挂起,但我设置了超时参数,php,linux,https,wechat,Php,Linux,Https,Wechat,我发现了一个奇怪的问题。这是我的php问题代码 static function sendImgMsg($openid, $mediaid, $access) {
static function sendImgMsg($openid, $mediaid, $access)
{
$csSelf= <<<EOF
{
"touser":"$openid",
"msgtype":"image",
"image":
{
"media_id":"$mediaid"
}
EOF;
$ret = Util::postRaw('https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=' . $access, $csSelf);
return json_decode($ret, true);
}
static function postRaw($url, $data)
{
$opts = array (
'http' => array (
'method' => 'POST',
'header'=> "Content-type: application/x-www-form-urlencoded\r\n" .
"Content-Length: " . strlen($data) . "\r\n",
'content' => $data,
'timeout' => 60
)
);
$context = stream_context_create($opts);
return file_get_contents($url, false, $context);
}
静态函数sendImgMsg($openid、$mediaid、$access)
{
$csSelf=“内容类型:应用程序/x-www-form-urlencoded\r\n”。
“内容长度:”.strlen($data)。“\r\n”,
“内容”=>$data,
“超时”=>60
)
);
$context=stream\u context\u create($opts);
返回文件获取内容($url,false,$context);
}
我调用sendImgMsg函数向特定服务器发送post数据。有时叫它会挂。最后,我发现它挂在文件\u get\u contents api中。我将显示有关文件内容的战略图片。
它挂起在读取系统调用中。但是fd是非阻塞的。为什么?任何建议都将不胜感激。尽量使用“永不回头:”)尽量使用“永不回头:”)