ASP 转译 PHP 的问题
<%
UrlHome = "http://"
Urls = Urls & "/xx/,/xx/,/xx/"
Urls = Urls & ",/xx/,/xx/,/xx/"
Urls = Urls & ",/xx/,/xx/,/xx/"
Urls = Urls & ",/xx/,/xx/,/xx/"
Urls = Replace(trim(Urls),",,",",")
if Left(Urls,1) = "," Then Urls = mid(Urls,2)
if Right(Urls,1) = "," Then Urls = left(Urls,Len(Urls)-1)
tmpUrls = Split(Urls & "," ,",")
randomize
RndNum=int(rnd()*ubound(tmpUrls))
if RndNum = ubound(tmpUrls) then RndNum =RndNum -1
ToUrl = TmpUrls(RndNum)
if left(ToUrl,7) <> "http://" then ToUrl = UrlHome & ToUrl
response.redirect ToUrl
%>
补充:知道的直接发给我
答案:<?php
/*
作者:万网互联 技术二部 猫七
主页: http://www.69dns.com
QQ: 89019585(技术) 87978065(导购) 更多客服请点击我们的问问团队
功能:ASP 转译 PHP 的问题
目的:通过好的服务,发掘更多的客户。当然我们的价格也是同行当中最低的
*/
$UrlHome = " http://127.0.0.1";
$Urls = ",/xx1/,/xx2/,/xx3/";
$Urls = $Urls . ",/xx4/,/xx5/,/xx6/";
$Urls = $Urls . ",/xx7/,/xx8/,/xx9/";
$Urls = $Urls . ",/xx10/,/xx11/,/xx12/,";$Urls = trim($Urls);
$Urls = str_replace(",,",",",$Urls);
if(substr($Urls,0,1) == ","){
$Urls = substr($Urls,1,strlen($Urls));
}
if(substr($Urls,-1,1) == ","){
$Urls = substr($Urls,0,strlen($Urls)-1);
}
$tmpUrls = explode(",",$Urls . ",");
$RndNum = mt_rand(0,count($tmpUrls));
if($RndNum == count($tmpUrls)){
$RndNum --;
}
$ToUrl = $tmpUrls[$RndNum];
if(substr($ToUrl,0,7) != "http://"){
$ToUrl = $UrlHome . $ToUrl;
}
header("Location:$ToUrl");
?>
按你的脚本,逐行翻译的
你好,可以的,可以聊。
上一个:PHP怎么过滤非法函数?
下一个:php socket fgets超时问题