我希望能够根据我网站的 url 更改页面 html 的特定值。例如,如果我想将值更改为“example”,我会转到 mysite.com/page.php?value=example
我是否可以做到这一点而不必在 php include 脚本中设置每个值?
最佳答案
在您的 php
页面上,更改以下内容:
<p>This is sample text and the word example.</p>
对此:
<p>This is sample text and the word <?php echo $_GET['value']; ?></p>
这会将 URL 中 ?value=
之后的任何值打印到页面上。
关于php - 根据URL更改内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15792736/