Разрешить обратную косую черту в URL-адресе symfony2Php

Кемеровские программисты php общаются здесь
Ответить
Anonymous
 Разрешить обратную косую черту в URL-адресе symfony2

Сообщение Anonymous »

Я создаю приложение для просмотра файлов с помощью Symfony 2.5 и Php 5.3.13.

Вот мой scanAction, который перечисляет файлы в каталоге:

Код: Выделить всё

public function listAction($client)
{
$dir_clients = $this->container->getParameter('dir_clients');
$dir_inter = ''.$dir_clients.'\\'.$client.'\\Interventions';

$interv = scandir($dir_inter);
$interv = array_slice($interv, 2);
$to_remove = array('Thumbs.db');
$interv_list = array_diff($interv, $to_remove);

return $this->render('MyBundle:Default:pilotage.html.twig', array(

// Here 'liste' = array of files in 'dir_interventions'
// 'dir_interventions' is a string of the directory

'liste' => $interv_list,
'dir_interventions' => $dir_inter,
));
}
Вот мой Pilotage.html.twig:

Код: Выделить всё

{% for files in liste %}

[url={{ path(]{{ files }} [/url]

{% endfor %}
Мой путь affiche_pilotage:

Код: Выделить всё

affiche_pilotage:
pattern:  /pilotage/{repertoire}/file}
defaults: { _controller: MyBundle:Default:affichePilotage}
requirements:
repertoire: .+
file: .+
Наконец-то мой affichePilotageAction();

Код: Выделить всё

public function affichePilotageAction( $repertoire , $file )
{
$response = new Response();
$response->setContent(file_get_contents(''.$repertoire.'/'.$file.''));
$response->headers->set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
$response->headers->set('Content-disposition', 'filename='. $file);

return $response;
}
Моя проблема в том, что сгенерированный

Подробнее здесь: https://stackoverflow.com/questions/424 ... l-symfony2
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»