HTML表单指向友好的URL [重复]

时间:2021-06-13 11:21:51

Possible Duplicate:
What is the best way to implement a friendly URL that has multiple variables using mod_rewrite?

可能重复:使用mod_rewrite实现具有多个变量的友好URL的最佳方法是什么?

I'm using mod_rewrite in my site for friendly URLs which works great. When using a form to add a variable to $_REQUEST it's being called in the regular format, and not the friendly one. My form is something simple like <input type="text" class="searchbox" id='searchid' name="query" value=""/> It now does directs to www.someurl.com?query="form data".

我在我的网站中使用mod_rewrite来获得友好的URL,这非常有用。当使用表单向$ _REQUEST添加变量时,它以常规格式调用,而不是友好格式。我的表单很简单,比如它现在指向www.someurl.com?query="form数据”。

I would like it to direct to a "friendly URL", something like:

我希望它指向一个“友好的URL”,如:

www.someurl.com/query/"form data"

How can I do that in PHP?

我怎么能用PHP做到这一点?

1 个解决方案

#1


-1  

Why not put every thing in a POST request?

为什么不把所有东西放在POST请求中?

like this

喜欢这个

<form method='post' action='/'>
   <input type='text' name='data' value='some value' />
</form>

the result in _request will be

_request的结果将是

array( 'data' => 'some value' )

array('data'=>'some value')

and you still retain your url structure.

而你仍然保留你的网址结构。

#1


-1  

Why not put every thing in a POST request?

为什么不把所有东西放在POST请求中?

like this

喜欢这个

<form method='post' action='/'>
   <input type='text' name='data' value='some value' />
</form>

the result in _request will be

_request的结果将是

array( 'data' => 'some value' )

array('data'=>'some value')

and you still retain your url structure.

而你仍然保留你的网址结构。