Mod_rewriting查询字符串到一个SWF文件字符串、文件、Mod_rewriting、SWF

2023-09-02 11:40:17 作者:向谁诉说思念

我试图使用mod_rewrite清理URL的一个Flash视频播放器。首先,这里是我试图改写原来的网址:

I'm attempting to use mod_rewrite to clean up the URL's to a flash video player. First, here is the original URL that I'm trying to rewrite to:

library/player.swf?path=path-to-file.flv

以上URL工作完全正常,当我直接访问它。我有codeD瑞士法郎来自动抓取路径参数,并播放视频。有没有问题。现在,这里是我尝试重写规则:

The above URL works perfectly fine when I access it directly. I have coded the swf to automatically grab the path parameter and play the video. No problems there. Now here is my attempted rewrite rule:

RewriteRule ^player/(.+)$ library/player.swf?path=$1 [QSA,L]

在访问URL播放器/路径到file.flv,我得到的SWF,但没有视频负载。我成立了一个弹出式窗口中的闪光告诉我的路径名用于调试的目的,它看起来像路径没有被通过的。

When visiting the url player/path-to-file.flv, I get the swf but no video loads. I set up a popup window in the flash to tell me the path name for debugging purposes, and it looks like the path isn't being passed at all.

在另一方面,如果我使用相同的规则,但它指向一个test.php的,而不是player.swf,该test.php的文件能够呼应出参数。

On the other hand if I use the exact same rule but point it to a test.php instead of player.swf, the test.php file is able to echo out the parameter.

因此​​,问题归结到,我在做一些不正确或已无法用mod_rewrite发送一个查询字符串的SWF?

So the question comes down to, am I doing something incorrectly or is it impossible to send a query string to a swf via mod_rewrite?

推荐答案

它使用您正试图在那里的机制是不可能的。请记住,一个.swf处理客户端的,所以所有的服务器正在做的是将文件发送到客户端。查询字符串无关此,服务器将基本上只是忽略它。

It is impossible using the mechanism you are attempting there. Remember that a .swf is processed client side, so all the server is doing is sending the file to the client. The query-string is irrelevant to this, and the server will essentially just ignore it.

有可能读取查询字符串参数中一个.swf文件,但同样不与直接提供文件。这再次是由于这些东西是如何工作...访问参数,瑞士法郎需要被嵌入在一个DOM,然后将能够通过DOM接口访问DOM和获得查询字符串,所以将曾作为HTML页面的一部分。

It is possible to read query string parameters in a .swf file, but again not with a directly served file. This is again due to how these things work... to access the parameters, the .swf needs to be embedded in a DOM and it will then be able to access the DOM and obtain the query string through the DOM interfaces, so will be served as part of a html page.

如果它的任何帮助,这是一种我见过的相当频繁,以获得参数转换为SWF文件是使用PHP脚本动态创建的标签和设置以这种方式的参数对应的查询字符串参数,数据库变量等整个页面再服,以及参数传递到瑞士法郎的应用程序时,它是由Flash运行时运行。

If it's any help, a way I've seen quite frequently to get the parameters into a .swf file is to use a PHP script to dynamically create the tags and set parameters in this fashion corresponding to query string parameters, database variables, etc. The entire page is then served, and the parameters are passed into the .swf app when it is being run by the flash runtime.