destoon 多表联合查询时出现解析错误,parse_str函数解析错误
數據庫前綴 ?wb_
?
標簽 ,調用文章時獲取評論數量
?<!--{php $tags=tag("table=article_24 a left join wb_comment_stat c on c.itemid=a.itemid&condition=status>2 and level=1&pagesize=3&order=hits desc&template=null");}-->
?
出現結果 sql語句?SELECT * FROM wb_article_24 a left join wb WHERE status>2 and level=1 ORDER BY hits desc LIMIT 0,3
include/tag.func.php ?中調試
在parse_str函數前后分別輸出?$parameter ?print_r($par);?
?
echo $parameter."<br>"; ??
parse_str($parameter, $par);
print_r($par); ? ? ? ?
?? ? ? ? ? ??
$parameter結果:?
table=article_24 a left join wb_comment_stat c on c.itemid=a.itemid&condition=status>2 and level=1&pagesize=3&order=hits desc&template=null ? ? 這里正常
?
print_r($par);的結果
?
Array ( ? ?[table] => article_24 a left join wb ? ?[#95;comment_stat_c_on_c_itemid] => a.itemid ? ?[condition] => status>2 and level=1 ? ?[pagesize] => 3 ? ?[order] => hits desc ? ?[template] => null )
可以看出 print_r 函數把 wb_ 后的_編碼成了_ 然后解析成了兩個變量。為什么會這樣????
?
解決方案,把wb_換成destoon_后解析正常,所以 在標簽里用destoon_ 然后再parse_str后 獲取到$table 后 替換成wb_
?
?
? ? <!--{php $tags=tag("table=article_24 a left join destoon_comment_stat c on c.itemid=a.itemid&condition=status>2 and level=1&pagesize=3&order=hits desc&template=null");}-->
?
然后再tag.func.php 大概100行 ?$table = str_replace('_', '_', $table); 之后加入
$table = str_replace('destoon_', $prefix, $table); ?//解決煩人的wb_問題,前綴是wb時 parse_str解析有問題,?
轉載于:https://www.cnblogs.com/djiz/p/6414271.html
總結
以上是生活随笔為你收集整理的destoon 多表联合查询时出现解析错误,parse_str函数解析错误的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Sql查询一个列对应多个列
- 下一篇: mac添加取消开机启动