简体   繁体   English

Symfony2简单的nonsymfony php文件如何路由?

[英]Symfony2 simple nonsymfony php file how to route?

I have a simple php file say just 我有一个简单的PHP文件说

<?php echo "Hello World"?>

Where should I put the file and how should I write the config, so that I can create a route to this file when I go to http://domainname/externalphp.php 我应该在哪里放置文件,以及如何编写配置文件,以便在转到http://domainname/externalphp.php时可以创建到该文件的路由。

I'd assume it does not have to involve any controller or anything like that, since this is external php. 我认为它不必涉及任何控制器或类似的东西,因为这是外部php。

You would have to change your apache/nginx vhost configuration for that. 您必须为此更改apache / nginx虚拟主机配置。

Your current configuration rewrites requests to your web/ folder to go through the app.php (or app_dev.php in the dev environment) file. 您当前的配置会将请求重写到您的web /文件夹中,以通过app.php(或在开发环境中为app_dev.php)文件。 You will need to add a special case for '/externalphp.php' to avoid this rewriting. 您将需要为'/externalphp.php'添加一个特殊情况,以避免重写。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM