略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Session::quoteName

2024-11-14

Session::quoteName

(No version information available, might only be in Git)

Session::quoteNameAdd quotes

说明

public mysql_xdevapi\Session::quoteName(string $name): string

A quoting function to escape SQL names and identifiers. It escapes the identifier given in accordance to the settings of the current connection. This escape function should not be used to escape values.

参数

name

The string to quote.

返回值

The quoted string.

范例

示例 #1 mysql_xdevapi\Session::quoteName() example

<?php
$session 
mysql_xdevapi\getSession("mysqlx://user:password@localhost");

$first "MySQL's test";
var_dump($first);
var_dump($session->quoteName($first));

$second 'Another `test` "like" `this`';
var_dump($second);
var_dump($session->quoteName($second));
?>

以上例程的输出类似于:

string(12) "MySQL's test"
string(14) "`MySQL's test`"

string(28) "Another `test` "like" `this`"
string(34) "`Another ``test`` "like" ``this```"
add a noteadd a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/mysql-xdevapi-session.quotename.php

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