Sections
Tableau
Description | PHP | YSM | Symfony 2 |
---|---|---|---|
Path Info | $_SERVER['PATH_INFO'] |
- |
$request->getPathInfo() |
Request | $_REQUEST['foo'] |
rs('foo') |
? |
Get | $_GET['foo'] |
gs('foo') |
$request->query->get('foo') |
Post | $_POST['foo'] |
posts('foo', \'default\') |
$request->request->get('foo', 'default') |
Server | $_SERVER['HTTP_HOST'] |
- |
$request->server->get('HTTP_HOST') |
Files | $_FILES['foo'] |
- |
$request->files->get('foo') |
Cookies | $_COOKIE['PHPSESSID'] |
- |
$request->cookies->get('PHPSESSID') |
Request Headers | ? |
- |
$request->headers->get('content_type') |
Method | $_SERVER['REQUEST_METHOD'] |
- |
$request->getMethod() |
Languages | $_SERVER['HTTP_ACCEPT_LANGUAGE'] |
get_http_accept_language(array('fr','en')) |
$request->getLanguages(); $request->getPreferredLanguage(array('fr','en')) |
SSL | ? |
- |
$request->isSecure() |
Response | headers('HTTP/1.1 200 OK'); headers('Content-type: text/html'); echo ''; |
- |
$response->setStatusCode(Response::HTTP_OK); $response->headers->set('Content-type', 'text/html'); $response->setContent(''); $response->send(); |
Routing | ? |
mod*/index.php |
app/config/routing.yml or app/config/routing.xml or app/config/routing.php |
Controller file | - |
app/modname/index.php |
src/AppBundle/Controller/NameController.php |
Controller namespace | - |
- |
AppBundle\Controller |
Controller class name | - |
name_index |
NameController |
Controller action function name | - |
zone_name |
nameAction |
Controller action return | - |
- |
new Response() |
Response/request | - |
- |
HttpFoundation |
- |
- |
Routing |
|
- |
app/helpers/Form_Helper.php |
Form |
|
- |
- |
Validator |
|
- |
- |
Templating |
|
- |
- |
Security |
|
- |
/app/po/ |
Translation |
|
Rendering | $variable = 123; include 'abc.php'; |
$this->set('variable',123); $this->set('view', array('zone','module','action')); |
$this->render('file/name.html.php', array('variable',123)); |
Get Item | ... |
$p = new post_Item(); $post = $p->fetch_item(1); |
$post = $this->get('doctrine')->getManager()-> getRepository('AppBundle:Post')->find(1); |
Get List | ... |
$p = new post_List(); $pager = new Array(); $posts = $p->toArray($pager); |
$posts = $this->get('doctrine')->getManager()-> createQuery('SELECT p FROM AcmeBlogBundle:Post p')->execute(); |
Erreur 404 | - |
wp-content: (\'view\', \'404\') |
throw $this->createNotFoundException(); |
Redirection | headers('Location: '.$url) |
$this->_redirect($url) |
return $this->redirect($url); return new RedirectResponse($url); |
Flash | - |
- |
$request->getSession()->getFlashBag()->add('notice', 'bla') |
URL | - |
_urlhtml('zone','module','action',array()) |
$view['router']->generate('module_action', array()) |
URL Resources | - |
admin: WEBSITE_ADMIN_ROOT.'/css/test.css' wp-content: get_template_directory().\'/css/test.css\' |
$view['assets']->getUrl('css/test.css') |
Templating | - |
- |
slots, output, set, extend... |
Profiling Templating | - |
- |
$view['stopwatch']->start('foo'); $view['stopwatch']->stop('foo') |
Escape HTML | htmlspecialchars($s) |
html($s) |
$view->escape($s) |
Escape in JS script tag | - |
- |
$view->escape($s, 'js') |
Symfony2
Symfony2 pré-initalisation
// $request use Symfony\Component\HttpFoundation\Request; $request = Request::createFromGlobals(); // response use Symfony\Component\HttpFoundation\Response; $response = new Response();
Dernière modification: 2015-01-20 17:38:43 par Yan Morin
Hébergé par ProgYSM