0
我想從我的頁面做谷歌搜索和搜索是基於特定的一組strings.so下面的代碼有一些PHP值的PHP數組字段..如果我需要使用他們在執行搜索時,如何做到這一點,我試圖處理下面的代碼,但它不工作。基於PHP數組字段搜索
enter code here
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.9.1.js"></script>
<script src="//code.jquery.com/ui/1.10.4/jquery-ui.js"></script>
<?php $fieldArray=array('fruits','gold','pen');?>
<script>
function searchLink()
{
var link1 = document.getElementById("search").value;
window.location.href = 'https://www.google.co.in/?q='+link1;
}
$(function() {
var availableTags = <?php echo json_encode($fieldArray)?>
$("#search").autocomplete({
source: availableTags
});
});
</script>
</head>
<input type="text" name="search" id="search" style="width:400px;"/>
<input type="button" name="searchBtn" id="searchBtn" value="Search" onclick="searchLink()"/>
你說的是元關鍵字? – CMPS
我不這麼認爲..我想要的是執行一個簡單的搜索在谷歌根據關鍵字輸入搜索與存儲在PHP數組字段中的值,我該怎麼做 – Krishnaft9