其中`{$tablepre}article_new`中的$tablepre为$tablepre=ro_,相应于我有个re_article_new的表,
那这里为什么要将$tablepre用{}括起来呢?

解决方案 »

  1.   

    1 加"`" 是为了防止表名字段名同关键词相冲突.
    如  你有一个字段名 AS  那么,如果不用 "`" 包起来的话.SQL语句就会出错.2 PHP中 "ABC$abc" 表示法 相当于 "ABC".$abc 
    所以 {$tablepre}article  就相当于 $tablepre."article "为什么用 {} 呢,主要是把变量名分开了.试想  $tableprearticle  让PHP如何知道  这个变量倒底是 $table + prearticle 还是 $ta+bleprearticle 呢??还是 本就一个 $tableprearticle 变量呢??不知道这样说你明白了不??