如何将Google自定义搜索引擎的结果重定向到results.php页面?

问题描述 投票:1回答:1

我创建了Google CSE,搜索框位于网站的主页上。用户搜索时,应将其重定向到带有结果的results.php,但是,它将它们重定向到cse.google.com/randomurl。

它设置为具有两页格式,因此应该没有问题。我尝试将动作添加到表单中,但是没有运气。

<form class="form-inline" action="results.php" method="POST">
  <div class="md-form my-0">
    <script async src="https://cse.google.com/cse.js?cx=983049830948390:lxzkzf8ljowm"></script>
    <div class="gcse-searchbox-only"></div>
  </div>
</form>

**我出于匿名目的修改了此问题中的自定义搜索引擎URL。

html google-custom-search
1个回答
3
投票

documentation显示如下:

<div class="gcse-searchbox-only" data-resultsUrl="YOUR_RESULTS_PAGE_URL"></div>

您有:

<div class="gcse-searchbox-only"></div>
© www.soinside.com 2019 - 2024. All rights reserved.