略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: SphinxClient::escapeString

2024-12-23

SphinxClient::escapeString

(PECL sphinx >= 0.1.0)

SphinxClient::escapeStringEscape special characters

说明

public SphinxClient::escapeString ( string $string ) : string

Escapes characters that are treated as special operators by the query language parser.

参数

string

String to escape.

返回值

Returns escaped string.

add a note add a note

User Contributed Notes 1 note

up
-1
xxxbunker dot com
9 years ago
according to http://www.sphinxsearch.com/forum/view.html?id=5225:

this function doesn't really do what one would expect (mysql_real_escape_string style) and is more meant to escape individual keywords...

my experience it works better to manually escape reserved characters, for example:

<?php
$string
='make big $ online';

$escaped=str_replace('$','\\$',$string);
?>

官方地址:https://www.php.net/manual/en/sphinxclient.escapestring.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3