从链接表单输入
所以我有:
<input type="text" id="keyword" placeholder="placeholder" value="" />
根据链接定义值的最佳方法是什么?
IE。
http://mysite.com/valueplacer?=thisisthevalue
这样做:
<input type="text" id="keyword" placeholder="placeholder" value="thisisthevalue" />
谢谢!
So I have:
<input type="text" id="keyword" placeholder="placeholder" value="" />
What is the best way to go about defining the value based on the link?
ie.
http://mysite.com/valueplacer?=thisisthevalue
Does this:
<input type="text" id="keyword" placeholder="placeholder" value="thisisthevalue" />
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
假设您要在查询字符串中放置一个
q
作为变量的键。这意味着查询字符串将类似于htmlspecialchars()
,这是为了安全起见。如果您确实希望 URL 看起来像这样,则需要解析
$_SERVER['REQUEST_URI']
。我不建议这样做。只需按照预期方式使用 GET 参数即可。
This is assuming that you are going to place a
q
there in the query string, as the key for the variable. This means the query string will look likeThe
htmlspecialchars()
is for security.If you actually do want your URL to look like that, you will need to parse
$_SERVER['REQUEST_URI']
.I would not recommend doing it like that. Just use GET params as how they were intended.