本文整理汇总了PHP中search::go方法的典型用法代码示例。如果您正苦于以下问题:PHP search::go方法的具体用法?PHP search::go怎么用?PHP search::go使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类search
的用法示例。
在下文中一共展示了search::go方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
<?php
$custom_css = array('search.scss', 'forum.scss');
$page_title = 'Search';
require_once 'header.php';
$search = new search($app);
if (isset($_GET['q'])) {
$q = preg_replace('/[^a-zA-Z0-9"@._-\\s]/', '', strip_tags(html_entity_decode($_GET['q'])));
$results = $search->go($q);
}
?>
<h1>Search</h1>
<form action="/search.php" method="GET">
<input type="text" placeholder="Search term" value="<?php
echo isset($_GET['q']) ? htmlspecialchars($_GET['q']) : '';
?>
" name="q" class='short'>
<input type="submit" value="Search" class="button left">
</form>
<?php
if (isset($_GET['q'])) {
?>
<strong class='white'>Search results for:</strong> <?php
echo $search->getLastSearchTerm();
?>
<br/><br/>
<?php
//Are there any results
if (!$results['articles'] && !$results['users'] && !$results['forum']) {
示例2: load
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Jetbird. If not, see <http://www.gnu.org/licenses/>.
*/
if (!function_exists("redirect")) {
// This means that this page hasn't been included right
die;
}
load("search");
switch ($_GET['action']) {
case "search":
$text = $_POST['search'];
$post = search::go($text);
if (!$post) {
unset($post);
}
//die(var_dump($post));
$smarty->assign("results", $post);
break;
case "search_weight":
$text = $_GET['text'];
$post = search::search_by_weight($text, 3);
if (!$post) {
unset($post);
}
//die(var_dump($post));
$smarty->assign("results", $post);
break;
示例3: htmlspecialchars
<?php
header('Content-Type: application/json');
require_once 'init.php';
$result = array("status" => false);
if (isset($_GET['user'])) {
if (isset($_GET['max'])) {
$max = $_GET['max'];
} else {
$max = 5;
}
$users = $app->utils->search_users($_GET['user'], $max);
if ($users) {
$result['status'] = true;
$result['users'] = $users;
}
} else {
if (isset($_GET['search'])) {
$search = new search($app);
$q = preg_replace('/[^a-zA-Z0-9"@._-\\s]/', '', strip_tags(html_entity_decode($_GET['search'])));
$result['data'] = $search->go($q);
if ($result['data']['articles'] || $result['data']['users'] || $result['data']['forum']) {
$result['status'] = true;
}
}
}
$json = json_encode($result);
echo htmlspecialchars($json, ENT_NOQUOTES);