我只是碰巧看到了以下编写参数化 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
'必须匹配,为什么?