新手请教.get方法如何使用
程序员文章站
2023-12-26 09:46:03
...
刚学jquery,试了一个例子,有两个页面index.html,data.php,但每次执行都显示的都是乱码,请问该怎么办?
index.html
New Document
data.php
if($_GET['what']=='good')
{
$names=array('Sherlock Helmes','John Watson','Hercule Poirot','Jane Marple');
echo getHTML($names);
}
else if($_GET['what']=='bad')
{
$names=array('Professor Moriarty','Sebastian Moran','Charles Milverton','Von Bork','Count Sylvius');
echo getHTML($names);
}
function getHTML($names)
{
$strResult='
return $strResult;
}
?>
index.html
data.php
if($_GET['what']=='good')
{
$names=array('Sherlock Helmes','John Watson','Hercule Poirot','Jane Marple');
echo getHTML($names);
}
else if($_GET['what']=='bad')
{
$names=array('Professor Moriarty','Sebastian Moran','Charles Milverton','Von Bork','Count Sylvius');
echo getHTML($names);
}
function getHTML($names)
{
$strResult='
- ';
- '.$names[$i].' ';
for($i=0;$i
$strResult.='
}
$strResult.='
return $strResult;
}
?>
回复讨论(解决方案)
没有配置php的环境
最好的办法 看手册
还真是没配置PHP环境,谢谢