我有這樣的代碼定義的file_get_contents可變
<?php
$a1 = 'http://www.hamooz.com';
$a2 = 'http://www.myegy.com';
$a3 = 'http://www.tech-wd.com/wd';
$num = rand(1,3);
$numb = '$a'.$num;
echo file_get_contents($numb);
?>
問題出現,如:
警告:的file_get_contents($ A3)function.file-GET-內容]:未能打開流:第9行的C:\ xampp \ htdocs \ ttt \ bessah.php中沒有這樣的文件或目錄
@ AD7six如此。這是更多的教學目的,但array_rand肯定需要提及,我會添加它。 –
感謝它的工作 –
此外,該數組可以聲明爲'$ a = array('http://www.hamooz.com',...)' –