Deprecated: Optional parameter $keys declared before required parameter $cms_id is implicitly treated as a required parameter in /home/www/dev/work/class/blog/CmsKey.php on line 75

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$title is deprecated in /home/www/dev/work/website/lvesu/class/controller/blog/php.php on line 28

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$outlink is deprecated in /home/www/dev/work/website/lvesu/template/blog/cms/php.manual.tpl on line 2

Deprecated: Creation of dynamic property lvesu\lvesu\controller\blog\php::$status is deprecated in /home/www/dev/work/website/lvesu/template/blog/index.head.php on line 2
PHP - Manual: dbx_escape_string - 互联网笔记

略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: dbx_escape_string

2025-06-09

dbx_escape_string

(PHP 4 >= 4.3.0, PHP 5 < 5.1.0, PECL dbx >= 1.1.0)

dbx_escape_string Escape a string so it can safely be used in an sql-statement

说明

dbx_escape_string ( object $link_identifier , string $text ) : string

Escape the given string so that it can safely be used in an sql-statement.

参数

link_identifier

The DBX link object returned by dbx_connect()

text

The string to escape.

返回值

Returns the text, escaped where necessary (such as quotes, backslashes etc). On error, NULL is returned.

范例

Example #1 dbx_escape_string() example

<?php
$link   
dbx_connect(DBX_MYSQL"localhost""db""username""password")
    or die(
"Could not connect");

$text dbx_escape_string($link"It\'s quoted and backslashed (\\).");
$result dbx_query($link"insert into tbl (txt) values ('" $text "')");
if (
$result == 0) {
    echo 
dbx_error($link);
}
dbx_close($link);
?>

参见

  • dbx_query() - Send a query and fetch all results (if any)
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/function.dbx-escape-string.php

冷却塔厂家 广告
中文GPT4.0无需注册 广告
北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3