我偶然看到了以下编写参数化SQL查询的方式:
function select_user($uid)
{
// what is '<<<'?
// I can't google any document about it
// (or I don't know how to search symbol)
$sqlStr = <<< SQL_STR
SELECT * FROM user WHERE uid = ?
SQL_STR; // must put in the begin of the line
// and it must match the word at the right hand side of '= <<<'
// Code Igniter Database Class
return $this->db->query($sqlStr, array($uid));
}
以下是我需要转述的问题:
- 符号 '
<<<
' 有什么作用? - 我的同事说必须匹配 '
SQL_STR
',为什么?