使用 Smarty 标签我想确定一个 URL 是否包含一个词,例如:
{if $smarty.get.page contains "product.php"} .....
我知道 contains 不存在,但我怎么能轻松地编写类似的东西来实现上述代码呢?
最佳答案
All PHP conditionals and functions are recognized, such as ||, or, &&, and, is_array(), etc.
{if strpos($smarty.get.page, "product.php") !== false}
关于php - Smarty 如果 URL 包含,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8280984/