php中fsockopen详细实例代码
n"; } //如果创建成功 else { //接受连接 while ($conn = stream_socket_accept($socket)) { //写入数据 fwrite($conn, 'the local time is ' . date('n/j/y g:i a') . "n"); //关闭连接 fclose($conn); } //关闭socket fclose($socket); } // $file = "test.txt"; //定义文件 $fp = fopen($file, "w"); //打开数据流 if ($fp) //如果成功打开 { stream_set_write_buffer($fp, 0); //设置缓冲区 fwrite($fp, $output); //写入内容 fclose($fp); //关闭数据流 }
永久链接:
转载随意!带上文章地址吧。
PHP之友评论