(沒有版本資訊,可能只在 Git 中)
Session::quoteName — 加入引號
一個用於跳脫 SQL 名稱和識別符號的引號函式。它會根據目前連線的設定跳脫給定的識別符號。此跳脫函式不應用於跳脫值。
name
要加引號的字串。
已加引號的字串。
範例 #1 mysql_xdevapi\Session::quoteName() 範例
<?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```"