"www.b.com/gaoxin", 2 => "www.c.c"/> "www.b.com/gaoxin", 2 => "www.c.c">
怎样获得这样的sql
表site_url有两个字段
id:序号
url:路径
name:名称
现有个路径数组
$pagearr = array(
0 => "www.a.com",
1 => "www.b.com/gaoxin",
2 => "www.c.com/xinzhan",
)
想通过这个路径数组获得名称
$pagestr = implode(',', $pagearr);
$sql = "SELECT * FROM site_url WHERE url IN ('{$pagestr}')";
打印出来的sql为:
SELECT * FROM site_url WHERE url IN('www.a.com,www.b.com/gaoxin,www.c.com/xinzhan')
这是不对的,实际想获得的sql是
SELECT * FROM site_url WHERE url IN('www.a.com','www.b.com/gaoxin','www.c.com/xinzhan')
该怎么做才能获得这样的sql
------解决方案--------------------
$pagestr = implode("','", $pagearr);