我是 symfony 2.3 的新手,我在从控制器运行独立的 php 文件时遇到问题。我想从 shell_exec() 运行该文件并在我的代码中使用它的输出。但我不知道在哪里找到我想要运行的文件的正确方法。我的控制器代码如下
namespace my\apiBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Request;
Class newController extends Controller
{
 public function getlibAction($text)
 {
    $out = shell_exec("php script/data.php");
    /*
    my rest code to take data from output
    */
    $response = new Response();
    $response->headers->set('Content-Type', 'text/html');
    $response->setContent($out);
    return $response;
 }
}
我已将包含“data.php”的“script/”文件夹复制到“my/apiBundle/Resources/public/”,但我无法访问它。我尝试在“my/apiBundle/”中独立复制它,但仍然没有成功。
我不知道我应该找到它。请帮我解决这个问题。提前致谢..