PHP Velho Oeste 2024

SphinxClient::escapeString

(PECL sphinx >= 0.1.0)

SphinxClient::escapeString特殊文字をエスケープする

説明

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

クエリ言語パーサが特殊文字を解釈する文字をエスケープします。

パラメータ

string

エスケープする文字列。

返り値

エスケープした文字列を返します。

add a note add a note

User Contributed Notes 1 note

up
0
xxxbunker dot com
14 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);
?>
To Top