开发者

How to disable routing in Symfony2 for certain paths/urls

I would like to call a php file directly from javascript in my SF2 application without routing/controllers.

The reason therefore is, that an external js framework (dhtmlx) has to call "generate.php" to produce an excel report. I put the generate.php under "vendors/dhtmlx/generate.php".

开发者_开发问答How can I call the generate.php file without a route?

I could implement a route to this file, but then the file is no controller object...


This problem is, I think, something outside of Symfony's goals. Of course you can create a dummy controller for it which just includes generate.php (good if access control is desired), or use your webserver's URL-to-file mapping (mod_rewrite or mod_alias) and I would even recommend putting it on a different virtual host.


You could use htaccess for that problem, i had a similar problem - i wanted that my api folder in the web folder get called directly and added this line into my .htaccess file

RewriteCond %{REQUEST_URI} "/api/"
RewriteRule (.*) $1 [L]

you could add something similar to you .htaccess like

RewriteCond %{REQUEST_URI} "/path/to/your/folder/"
RewriteRule (.*) $1 [L]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜