Created
May 7, 2018 09:49
-
-
Save ertankayalar/de0e8d8d35ec64f5533eea25f12c3f83 to your computer and use it in GitHub Desktop.
Simple Symfony Blog Controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/Controller/BlogController.php | |
| namespace App\Controller; | |
| use Symfony\Bundle\FrameworkBundle\Controller\Controller; | |
| use Symfony\Component\Routing\Annotation\Route; | |
| class BlogController extends Controller | |
| { | |
| /** | |
| * /blog adresine ayarlı | |
| * | |
| * @Route("/blog", name="blog_list") | |
| */ | |
| public function list() | |
| { | |
| // ... | |
| } | |
| /** | |
| * /blog/* ile başlayan adreslere ayarlı | |
| * | |
| * @Route("/blog/{slug}", name="blog_show") | |
| */ | |
| public function show($slug) | |
| { | |
| // $slug URL'nin dinamik parçası | |
| // Örneğin /blog/makale-adresi adresi girilirse | |
| // $slug='makale-adresi' olacak | |
| // ... | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment