本文整理汇总了PHP中adodb_str_replace函数的典型用法代码示例。如果您正苦于以下问题:PHP adodb_str_replace函数的具体用法?PHP adodb_str_replace怎么用?PHP adodb_str_replace使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了adodb_str_replace函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qstr
function qstr($s, $magic_quotes = false)
{
if (!$magic_quotes) {
if (ADODB_PHPVER >= 0x4300) {
if (is_resource($this->_connectionID)) {
return "'" . mysql_real_escape_string($s, $this->_connectionID) . "'";
}
}
if ($this->replaceQuote[0] == '\\') {
$s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s);
}
return "'" . str_replace("'", $this->replaceQuote, $s) . "'";
}
// undo magic quotes for "
$s = str_replace('\\"', '"', $s);
return "'{$s}'";
}
示例2: qstr
/**
* Correctly quotes a string so that all strings are escaped. We prefix and append
* to the string single-quotes.
* An example is $db->qstr("Don't bother",magic_quotes_runtime());
*
* @param s the string to quote
* @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc().
* This undoes the stupidity of magic quotes for GPC.
*
* @return quoted string to be sent back to database
*/
function qstr($s, $magic_quotes = false)
{
if (!$magic_quotes) {
if ($this->replaceQuote[0] == '\\') {
// only since php 4.0.5
$s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s);
//$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s));
}
return "'" . str_replace("'", $this->replaceQuote, $s) . "'";
}
// undo magic quotes for "
$s = str_replace('\\"', '"', $s);
if ($this->replaceQuote == "\\'") {
// ' already quoted, no need to change anything
return "'{$s}'";
} else {
// change \' to '' for sybase/mssql
$s = str_replace('\\\\', '\\', $s);
return "'" . str_replace("\\'", $this->replaceQuote, $s) . "'";
}
}
示例3: _decode
function _decode($blob)
{
eval('$realblob="' . adodb_str_replace(array('"', '$'), array('\\"', '\\$'), $blob) . '";');
return $realblob;
}
示例4: qstr
function qstr($s, $magic_quotes = false)
{
if (is_null($s)) {
return 'NULL';
}
if (!$magic_quotes) {
if (PHP_VERSION >= 5) {
return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'";
}
if ($this->replaceQuote[0] == '\\') {
$s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s);
}
return "'" . str_replace("'", $this->replaceQuote, $s) . "'";
}
// undo magic quotes for "
$s = str_replace('\\"', '"', $s);
return "'{$s}'";
}
示例5: BlobEncode
function BlobEncode($blob)
{
if (ADODB_PHPVER >= 0x5200) {
return pg_escape_bytea($this->_connectionID, $blob);
}
if (ADODB_PHPVER >= 0x4200) {
return pg_escape_bytea($blob);
}
/*92=backslash, 0=null, 39=single-quote*/
$badch = array(chr(92), chr(0), chr(39));
# \ null '
$fixch = array('\\\\134', '\\\\000', '\\\\047');
return adodb_str_replace($badch, $fixch, $blob);
// note that there is a pg_escape_bytea function only for php 4.2.0 or later
}
示例6: qstr
function qstr($s, $magic_quotes = false)
{
if (!$magic_quotes) {
if (PHP_VERSION >= 5)
return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'";
if ($this->replaceQuote[0] == '\\')
$s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s);
return "'".str_replace("'",$this->replaceQuote,$s)."'";
}
// undo magic quotes for "
$s = str_replace('\\"','"',$s);
return "'$s'";
}
示例7: qstr
/**
* Correctly quotes a string so that all strings are escaped. We prefix and append
* to the string single-quotes.
* An example is $db->qstr("Don't bother");
*
* @param s the string to quote
*
* @return quoted string to be sent back to database
*/
public function qstr($s)
{
if ($this->replaceQuote[0] == '\\') {
// only since php 4.0.5
$s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s);
//$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s));
}
return "'" . str_replace("'", $this->replaceQuote, $s) . "'";
}
示例8: qstr
function qstr($s, $magic_quotes = false)
{
if (!$magic_quotes) {
if (ADODB_PHPVER >= 0x5000) {
// $this->_connectionID = $this->mysqli_resolve_link($this->_connectionID);
return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'";
} else {
trigger_error("phpver < 5 not implemented", E_USER_ERROR);
}
if ($this->replaceQuote[0] == '\\') {
$s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s);
}
return "'" . str_replace("'", $this->replaceQuote, $s) . "'";
}
// undo magic quotes for "
$s = str_replace('\\"', '"', $s);
return "'{$s}'";
}
示例9: _decode
function _decode($blob)
{
if ($blob === NULL) return NULL;
eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";');
return $realblob;
}