这里是test.html文件放在代码:谷歌定制搜索无法正常工作
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="zh-hans" xml:lang="zh-hans">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>test</title>
</head>
<body>
<div class="fr_search">
<form action="cse.php" accept-charset="UTF-8" method="post"
id="search-theme-form">
<input type="text" maxlength="128" name="search_theme_form"
id="edit-search-theme-form-1" size="15" value="" class="form-text" />
<input type="image" name="submit" id="edit-submit"
class="form-submit" src="images/search_btn_top.gif" /></div>
</form>
</div>
</body>
</html>
我把其中由http://www.google.com/cse/manage/create?hl=en生成的代码。 “我要输入的网站”是http://stackoverflow.com。当我把生成的代码放入cse.php。然后把cse.php和test.html放到我的本地php环境中。当我将文本“php”输入到搜索文本框中并单击搜索按钮时。但我的搜索结果页面上没有任何结果。我的步骤和代码有什么问题?谢谢。
这里是cse.php文件代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>test search</title>
</head>
<body>
<script src="http://www.google.com/jsapi" type="text/javascript"></script>
<script type="text/javascript">
google.load('search', '1', {language : 'en'});
google.setOnLoadCallback(function()
{
var customSearchControl = new google.search.CustomSearchControl ('011247711644571852159:xe2ytn1hwsa');
customSearchControl.setResultSetSize(google.search.Search.FILTERED_CSE_RESULTSET);
customSearchControl.draw('cse');
}, true);
</script>
<link rel="stylesheet" href="http://www.google.com/cse/style/look/default.css"
type="text/css" />
<?php echo 'test'; ?>
</body>
</html>
什么是PHP文件? – Blender 2011-03-20 03:33:19
魔法不足。在尝试插入自己的代码之前,网站是否在Google演示中工作? – 2011-03-20 03:37:38
我添加了php文件代码。 – runeveryday 2011-03-20 03:49:49