laravel 5 - Getting base_url into a PHP file of symfony3 framework -


i beginner symfony framework , want base url of

symfony3 framework view file. did r&d , how base url twig file using this.

 {{ app.request.getschemeandhttphost() }} 

but view

not twig file it .php file

so don't know how use base url in view .php file.

i base url head.blade.php file of laravel framework using:-

<?php echo url::to('/'); ?> 

i want symfony3 framework.

as explained on the doc : in symfony have create routes.

/**  * @route("/", name="site_home")  */ public function homeaction() {     // ... } 

in twig, can call routes :

{{ path('site_home') }} 

you can route in controller , pass view :

$homeurl = $this->get('router')->generate('site_home'); 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -