您好,登錄后才能下訂單哦!
<?php
header('access-allow-origin:*');
sleep(1);
echo "hello\n";
echo "world";
<?php
$url = 'http://localhost/test.php';
$output = file($url);
var_dump($output);
b. 輸出:
array(2) {
[0]=>
string(6) "hello"
[1]=>
string(5) "world"
}
<?php
$url = 'http://localhost/test.php';
$output = file_get_contents($url);
var_dump($output);
b. 輸出:
string(11) "hello world"
<?php
$url = 'http://localhost/test.php';
$handle = fopen($url,"rb");
do{
$data = fread($handle,1024);
if(strlen($data)==0) {
break;
}
$output = $data;
}
while(true);
fclose($handle);
var_dump( $output);
b. 輸出:
string(11) "hello world"
<?php
$url = 'http://localhost/test.php';
$ch = curl_init();
$timeout = 1;
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
$output = curl_exec($ch);
curl_close($ch);
var_dump($output);
b. 輸出:
string(11) "hello world"
<?php
$url = 'localhost/test.php';
$fp = fsockopen($url, 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
stream_set_blocking($fp,0);
$out = "GET / HTTP/1.1\r\n";
$out .= "Host: {$url}\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {
var_dump(fgets($fp, 128));
}
fclose($fp);
}
b. 輸出:
string(11) "hello world"
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。