假设您要在查询-6ren">
gpt4 book ai didi

php - 从链接表单输入

转载 作者:行者123 更新时间:2023-12-01 03:54:47 25 4
gpt4 key购买 nike

所以我有:

<input type="text" id="keyword" placeholder="placeholder" value="" />

根据链接定义值的最佳方法是什么?

即。

http://mysite.com/valueplacer?=thisisthevalue

这样做:

<input type="text" id="keyword" placeholder="placeholder" value="thisisthevalue" />

谢谢!

最佳答案

<input type="text" id="keyword" placeholder="placeholder" value="<?php echo htmlspecialchars($_GET['q']); ?>" />

假设您要在查询字符串中放置一个 q 作为变量的键。这意味着查询字符串将类似于

http://mysite.com/valueplacer?q=thisisthevalue

htmlspecialchars() 是为了安全起见。

如果您确实希望 URL 看起来像这样,则需要解析 $_SERVER['REQUEST_URI']

建议这样做。只需按照预期方式使用 GET 参数即可。

关于php - 从链接表单输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3860446/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com