BBS水木清华站∶精华区

发信人: thinkin (强强), 信区: Linux        
标  题: Random Link  
发信站: BBS 水木清华站 (Thu Feb 17 11:06:26 2000) 
 
<? 
// array with link entries in the form url|description 
$linkarray = array( "http://php.net/|PHP Official Site and Distribution", 
"http://www.devshed.com/|DevShed - Open Source Resources", 
"http://www.e-gineer.com/phpkb/index.phtml|e-gineer - PHP Knowledge Base", 
"http://phpclasses.upperdesign.com/|PHP Classes Repository", 
"http://www.phpbuilder.com/|PHPBuilder.com - PHP Resources", 
"http://phtml.com/|phtml.com - Free PHP Scripts", 
"http://www.phpwizard.net/|phpWizard.net - PHP Resources", 
"http://px.sklar.com/|PX: PHP Code Exchange", 
"http://www.weberdev.com/|Berber's Web Development Pages"); 
// seed the random number generator 
srand((double)microtime()*1000000); 
// get a random entry 
$randval = rand(0,count($linkarray)-1); 
// explode random entry into an array 
$entry = explode( "|",$linkarray[$randval]); 
// print entry 
print ( "Visit: <a href=\"$entry[0]\" target=\"_blank\">$entry[1]</a>"); 
?> 
-- 
 
人生到处知何似? 
    应似飞鸿踏雪泥。 
        泥上偶然留指爪, 
            鸿飞那复计东西! 
        
 
※ 来源:·BBS 水木清华站 smth.org·[FROM: 162.105.37.191] 

BBS水木清华站∶精华区