<?php
for($i=0;$i<10000000;$i++){
if ($_GET['act'] == $i){
$url = 'http://www.baidu.com/'.$i;
echo $url;
}
}
?>
127.0.0.1/?act=1
输出
http://www.baidu.com/1
127.0.0.1/?act=45456
输出
http://www.baidu.com/45456但是这样一旦数字越来越大 就越来越卡 几千几万内还是可以 8位就开始卡了9位要N久有没其他方法 最好可以 act=abc 这样的字母的也可以
比如
127.0.0.1/?act=abc
输出 http://www.baidu.com/abc
127.0.0.1/?act=abc
输出 http://www.baidu.com/abc127.0.0.1/?act=fhfhfjh
就输出 http://www.baidu.com/fhfhfjh127.0.0.1/?act=任意字幕数字
就输出 http://www.baidu.com/任意字幕数字
就可以了
if ($_GET['act'] == str_replace("/index.php?act=","",$_SERVER["REQUEST_URI"])){
$bb = '[{"id":'.$_GET['act'].',"name":"ccc"},{"id":'.$_GET['act'].',"name":"ddd"},{"id":'.$_GET['act'].',"name":"eee"}]';
echo $bb;
exit();
}
?>
<script
language="JavaScript" type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){$("#:input[type='button'][id]").click(function(){
var url="?act="+this.id;
$.post(url,'',function(msg){
var myObject = eval('(' + msg + ')'); //关键的一步,msg 为返回的类型为字符串,转化为json 对象
var str='';
var str2='';
var len=myObject.length;
for(i=0;i<len;i++){
str+='<tr><td>'+myObject[i].id+'#'+myObject[i].name+'</td><td><br>';
}
str2+='<input type="button" value="按钮3" id="789">';$('#rstable').html(str);
$('#rstable2').html(str2);})})})
</script>
<input type="button" value="按钮1" id="123">
<input type="button" value="按钮2" id="456">
<div id="rstable"></div>
<div id="rstable2"></div>按钮3不起作用 有没其他办法?127.0.0.1/index.php按钮1 按钮2正常 就是按钮3不起作用。