如何延遲5秒然後使用file_get_contents
PHP?如何延遲5秒,然後使用file_get_contents PHP?
我使用此代碼從使用網址的網頁獲取文本。
的index.php
<?PHP
$text = file_get_contents('https://www.othersite.com/test_1.php');
echo strip_tags($text); // If you only need text not html structure
?>
。
。
https://www.othersite.com/test_1.php
<meta http-equiv="refresh" content="5;url=https://www.othersite.com/test_2.php">
https://www.othersite.com/test_2.php
HELLO WORLD.
當我加載mysite的(的index.php)。如何延遲5秒,然後用file_get_contents
,它是會顯示結果HELLO WORLD.
什麼是延遲? – simon
好吧,如果不延遲,當我使用'file_get_contents'與'test_1.php'它會顯示空白數據。我想在使用'file_get_contents'之前延遲5秒鐘重定向到'test_2.php',結果將是'HELLO WORLD.' –
我仍然不明白你想要做什麼。 – simon