您可以通过 this.param 访问当前 URL 参数,它会返回一个 PHP 数组。
此示例演示如何访问页面中的 tab URL 参数。
这是一个测试:加粗和斜体和代码和链接和。
这是另一行。
第三行,包含更多代码和更多加粗。
url = "/account/:tab"{% if this.param.tab == 'details' %}
<p>Here are all your details</p>
{% elseif this.param.tab == 'history' %}
<p>You are viewing a blast from the past</p>
{% endif %}如果参数名也是一个变量,则可以使用数组语法。
url = "/account/:post_id"{% set name = 'post_id' %}
<p>The post ID is: {{ this.param[name] }}</p>