PHP Superglobals - Basic Routing Using The Server Info - Full PHP 8 Tutorial

  Рет қаралды 29,441

Program With Gio

Program With Gio

Күн бұрын

Пікірлер: 167
@zeeu
@zeeu Жыл бұрын
Ladies and Gentlemen, you've finally made it to the fun part
@ProgramWithGio
@ProgramWithGio Жыл бұрын
It gets more fun later on 😉
@zeeu
@zeeu Жыл бұрын
@@ProgramWithGio that's what I meant 😁
@yinonelbaz5309
@yinonelbaz5309 Жыл бұрын
With every new video I progress in this series, I get excited and excited all over again, it's unbelievable how great and in-depth this series is! Thanks gio for the investment!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Very happy to hear that you are progressing and videos are helpful, thank you 🙌
@isaacsouza17
@isaacsouza17 3 жыл бұрын
Laravel really hides does detail for us, but it is important to understand the fundamentals, thanks again for the free high quality content, keep it up
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Agreed. Pretty much all frameworks hide & abstract away such things. You're very welcome Isaac & thank you 🙌
@mwaas
@mwaas Жыл бұрын
You explain the hidden and essential things in frameworks. I will always be grateful to you
@mauriciocastro7572
@mauriciocastro7572 2 жыл бұрын
just as a reminder, for the router to work the server must be configured so that it redirects traffic to index.php, i was stuck in this for days without realising gio had already setup his server a few videos ago haha. this is seriously the best guide on php programming, much love
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Yea we covered that earlier. Thank you 💙. Here is the repo to outline that includes all videos in order: github.com/ggelashvili/learnphptherightway-outline
@deZOO77
@deZOO77 2 жыл бұрын
Thx man. I've been strugling with this for few hours, wondering what I did wrong, until I saw your comment:)
@VuPhuongThanh-BDCCN
@VuPhuongThanh-BDCCN 2 жыл бұрын
I use xampp and Could you help me how to configured router, i am very appreciate ?
@salvaddd
@salvaddd Жыл бұрын
Omg it happened the same to me! I was wondering for a couple of hours what was the problem. Maybe a little note should be added about this, as for example I started a second environment for this video without configuring the index redirect.
@tommauro2023
@tommauro2023 Жыл бұрын
Me too! For the ones that might have the same problem all the necessary configurations is in the tutorial about docker.
@benderbg
@benderbg 3 ай бұрын
This lesson even if its just basics really shows how much work it takes to router a few pages and how awesome frameworks have become in speeding up that process.
@ProgramWithGio
@ProgramWithGio 3 ай бұрын
Yup, frameworks make our lives a lot easier for sure
@2008rol
@2008rol 3 жыл бұрын
Agree with Isaac Souza. When first time I met Laravel, I really liked to know how its router works. But I found it was quite hard to trace. After watching this video, Gio gave me a lot more understanding on how router works. Thanks a lot
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you, glad to hear that 🙌
@karolzamojcin1886
@karolzamojcin1886 Жыл бұрын
Man, once you get the algorithm wave your sub base is going to skyrocket! Thank you 🙂
@ProgramWithGio
@ProgramWithGio Жыл бұрын
heh, thank you
@asifm3520
@asifm3520 3 жыл бұрын
Really appreciate your efforts in explaining every minute details. Great explanation. Thumbs up.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@NooBGaming23
@NooBGaming23 Жыл бұрын
Usually, I never comment but hats off to you! Thanks for that quality of knowledge.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
I appreciate that, thank you 💙
@mortezashabanipour6597
@mortezashabanipour6597 2 жыл бұрын
I couldnt sell any learning course beacuse of bad economy situation. And free online learning break my knowledge to seperate small parts. And i thought its not any better then these. But when i find you right in the time i,m going to very badly depression .... I cant show my entire respect in words... thank you You,re perfect , awesome excellect teacher Thank you so much
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome, I'm glad these are helpful, thank you & stay strong
@HeroGamingMaroc
@HeroGamingMaroc Жыл бұрын
Hi guys , im in love with this cours and thank gio , im correcting my university teacher errors 😂 beacuse of gio
@ProgramWithGio
@ProgramWithGio Жыл бұрын
That's awesome 🙌
@Vitalii-m6r
@Vitalii-m6r Жыл бұрын
Thanks for this extraordinarily useful PHP series again!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're very welcome 💙
@emekatimothyiloba699
@emekatimothyiloba699 Жыл бұрын
Wow Thanks Gio. now i understand how Laravel Route works
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Happy to hear 🙌
@mortezashabanipour6597
@mortezashabanipour6597 2 жыл бұрын
Thank you, you bring me back to life. Someday i,ll tell you the whole story
@abdallakaram5376
@abdallakaram5376 3 жыл бұрын
Gio is the best ❤
@pedroblancobarrera6013
@pedroblancobarrera6013 Жыл бұрын
Thou I have to watch a couple of times each videos to understand how it works behind the scenes, its really interesting how good things are done.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
🙌🙌
@mohammadalikarami9961
@mohammadalikarami9961 3 жыл бұрын
Please continue the good work. Amazing php course.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@KochADV
@KochADV 2 күн бұрын
Was using vscode and getting an error from the $requestUri... didnt try to debug.. will continue learning and perhaps look at this later. Great video again. Thanks
@slavmin
@slavmin 3 жыл бұрын
Perfect explanation!
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@galacticmeditation6764
@galacticmeditation6764 11 ай бұрын
This function can be use to get url path: $path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
@ProgramWithGio
@ProgramWithGio 11 ай бұрын
multiple ways to do it yup
@ינוןאלבז-כ1ז
@ינוןאלבז-כ1ז Жыл бұрын
Amaizing!!!! Thanks!!!!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome
@federicobau8651
@federicobau8651 2 жыл бұрын
Great video
@adrianez-programuj3313
@adrianez-programuj3313 3 жыл бұрын
Top quality content and explanation. Keep going.
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙏
@devnullex
@devnullex 3 жыл бұрын
Very very very great job! I love PHP. Keep goin
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you 🙌
@mwaas
@mwaas Жыл бұрын
12k view and just 500 like This course is free gold, at least hit the like button as a gratitude and thanks
@ProgramWithGio
@ProgramWithGio Жыл бұрын
I appreciate it, thank you 💙
@AMoktar
@AMoktar Жыл бұрын
Awesome 👏, 👍
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Thank you
@memack101
@memack101 2 жыл бұрын
Thank you.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
You're welcome!
@thiagoantonioferreira9614
@thiagoantonioferreira9614 Жыл бұрын
Hello Gio! Amazing explanation as always, I have the next question: In which part of the course did you explain the next sentence: [Home::class,'index']?, I don't understand it, why are you able to access to non static functions without initializing an object? Thanks a lot!!!
@thiagoantonioferreira9614
@thiagoantonioferreira9614 Жыл бұрын
Okey sorry, i think i figured out the meaning. Its just an array with the instructions to call a function inside of a class, which the first position is the address of the class, and the second position is the function to be called, right?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@thiagoantonioferreira9614 yup that is correct, it's just an array
@ilya_123__
@ilya_123__ Жыл бұрын
thank you!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome!
@olisaisama7083
@olisaisama7083 Жыл бұрын
Thank you mate. How can i include dynamic parameters on the routes or edit the query strings to fit something like /xyx?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Later in the course we use a proper router that provides such features
@olisaisama7083
@olisaisama7083 Жыл бұрын
@@ProgramWithGio thanks that will do alot digging
@porag_raihan
@porag_raihan Жыл бұрын
Hey boss, I can't type hint the $message property. The error shows that "Type of App\Exceptions\RouteNotFoundException::$message must not be defined (as in class Exception)".
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hey, that's because in the base class there is no typehint on that property, so you can't type hint it in the child class either
@musilicks
@musilicks Жыл бұрын
@@ProgramWithGio why wouldn't they typehint in the base class? typehinting is fun, Lord Gio.
@Zubbee
@Zubbee 2 жыл бұрын
Always wanted to know how routing was done and all. However this was a bit tough to grasp. I don't know weda to stay on it or to move on. I think I have a hint that the laravel frame work makes it easier but I always like to understand concepts at least. Thank you for this video Gio
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
It's alright, I would say move on & come back to it later.
@Zubbee
@Zubbee 2 жыл бұрын
@@ProgramWithGio Ok Gio I'll do just that. Thank you very much.
@VuPhuongThanh-BDCCN
@VuPhuongThanh-BDCCN 2 жыл бұрын
I write code exactly the same in video but when i type /invoices into url , it throws an error 404 not found , The requested URL was not found on this server. Can anyone help me , i use xampp
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
DM me on Twitter on Monday and I'll help you troubleshoot, send me screenshots of your code or better put it on GitHub and send me the link
@udalathudar
@udalathudar 10 ай бұрын
I am encountering the same issue. how did you solve the issue?
@chilibean6152
@chilibean6152 6 ай бұрын
Actual proplem
@gatzmamora1178
@gatzmamora1178 Жыл бұрын
Hey Gio, or anyone listening... Thanks Gio for this course, it is fantastic! I'm just having an issue where if I try to call a method from a class like [classes\Home::class, 'index']; it gets called as an array with "classes\Home" and "index" as a string. Does this technique for calling methods from methods from classes not work anymore?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hey, I'm not sure I understand the question, how are you calling the method? Do you use call_user_func_array?
@gatzmamora1178
@gatzmamora1178 Жыл бұрын
I missed the step where I had to add |array to the callable type in the register method. Got it! Thanks for replying and for this class!
@lahcenaouina
@lahcenaouina Жыл бұрын
Thank u so much , i have problem with routes not work correctly in appache
@ProgramWithGio
@ProgramWithGio Жыл бұрын
You're welcome. Any specific errors?
@lahcenaouina
@lahcenaouina Жыл бұрын
@@ProgramWithGio no errors but it gives me Page Not found , when i make own server (php -S localhost:5050) it work
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Probably some misconfiguration, I would need to see your apache configs, if you can DM me screenshots of your configs on Twitter I can help troubleshoot it
@lahcenaouina
@lahcenaouina Жыл бұрын
@@ProgramWithGio Ok thank u
@louisolitaire424
@louisolitaire424 Жыл бұрын
Hey Gio, I can’t thank you enough for making such a valuable content available on YT. That series is just amazing and the way you teach is brilliant! I have a quick question on this one though and I figured maybe you or someone else could help. I don’t understand how you can pass an array as the first argument in the call_user_func_array function. Is the array somehow casted into a callable? And if so, does it mean that we can invoke arrays shaped like this [App\MyClass, ‘method’]() ? Thanks again 😉Gratitude from France!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hey, thank you for the kind words. In PHP callable can be defined as an array as well with first element being the object or the class name and the second element being the method. You can check the docs for the callable type for more info: www.php.net/manual/en/language.types.callable.php
@louisolitaire424
@louisolitaire424 Жыл бұрын
Thanks a lot for the explanation.
@devanii
@devanii 2 жыл бұрын
i don't understand this piece [$class,$method] = $action the left side is an array which you replace with actin but it is still available later?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
It's called array destructuring. We covered it in first section: kzbin.info/www/bejne/e2WphpiNlpiKh80 at around 13 min or so
@devanii
@devanii 2 жыл бұрын
@@ProgramWithGio thanks! I saw many videos before this one but i could not remember this was explained :)
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@devanii no problem 👍
@Moriarty1982
@Moriarty1982 2 жыл бұрын
@@ProgramWithGio maybe an info link to the video with the timecode would be helpful for others? kzbin.info/www/bejne/e2WphpiNlpiKh80
@nemac23
@nemac23 2 жыл бұрын
10:50 Probably a dumb question, but why do this check? Why not always pass array to controller - what's the use of keeping callable option?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Not a dumb question at all. Its for convenience, you may want to register route based on a closure instead of an array. If you only want to use arrays you are free to do that.
@Armando-px8hi
@Armando-px8hi Жыл бұрын
Thank God Laravel exists 😂 Thank you GIO, just one question how did you learn PHP man, sometimes I just think it was written by you))
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Laravel is awesome, so is Symfony. I always keep on learning new things, I don't know/remember everything off the top of my head every time. Sometimes I forget the simple things. The key thing is, being able to figure it out when its needed.
@emekatimothyiloba699
@emekatimothyiloba699 Жыл бұрын
Hey Gio. Please why is the error message displayed that way "Uncaught RouteException". Is there not a way to display the neat error message??
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Because its an unhandled exception, you can create exception handler or use try/catch
@Nukker13
@Nukker13 Ай бұрын
For some reason, I get stuck on 8:33 part of the video, when the router is optimized to work with arrays. Any idea what could be fixed? It just throws the same routes error that is created earlier in this lesson, no idea why the URIs are not cathed properly.
@ProgramWithGio
@ProgramWithGio Ай бұрын
I'd have to look at your code to help you
@Nukker13
@Nukker13 Ай бұрын
@@ProgramWithGio is it possible to contact you? I saw you mentioned Twitter DMs, but I'm not sure if you're responding to such questions
@ProgramWithGio
@ProgramWithGio Ай бұрын
Twitter is the best way. I do respond it when I have free time
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
i got a question, this code with create Route object runs every time script is requested?
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
yes on every request. Frameworks usually cache routing
@Artorias_DS
@Artorias_DS Жыл бұрын
Hi Gio I was wondering what file extension you use for creating files. By the way, I really enjoy your content - it's always great.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Hello. Not sure what you mean, for which files? For PHP files I use .php extension
@Artorias_DS
@Artorias_DS Жыл бұрын
@@ProgramWithGio Hi, Gio. it's at 7:10, the way you created the class file. it's very convenient, would like to learn how to do it. Thank you
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@Artorias_DS that's just the IDE (phpstorm) making things easier, it creates the PHP class. Files still have PHP extension.
@DanielKhadivi
@DanielKhadivi Жыл бұрын
How do you navigate to the "invoice' page and still end up showing 'resolve' on index.php? Can't follow your routing example here. All other tutorials are great!
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Because all requests go through the index.php, thats where router is instantiated & proper route resolved
@DanielKhadivi
@DanielKhadivi Жыл бұрын
@@ProgramWithGio If you type a url ending in "/invoice" wouldn't that navigate to the "index.php" page? Why would it go to the main page at 'index.php'?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
​@@DanielKhadivi Request goes to the index.php & then index.php invokes the router which decides which page to render
@DanielKhadivi
@DanielKhadivi Жыл бұрын
@@ProgramWithGio Thank you for taking the time to respond. I have defined a "About.php" page in a "Pages" subfolder. The PHP server is configured using IIS / FastCGI, not Apache. When I type "localhost/phpTutorial/App/Pages/About.php", it goes directly to that page The full path on OS is: C:\inetpub\wwwroot\phpTutorial\App\Pages\About.php This seems to be the correct behavior of navigating to web page. The "app" root is at: "C:\inetpub\wwwroot\phpTutorial\App" . Again, I see no reason for the request to go to the "index.php" at the root of the app (where I have done similar registration to yours in your video), and then somehow redirect itself to the "About" page. There is no redirection logic. Sorry, I'm new to PHP and love your tutorials. What am I doing wrong?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
What you are doing doesnt really follow with what we are doing in this lesson. In this lesson we set up routing in a way so that all traffic is routed through public/index.php, so that acts as our front controller. Then we have the router that maps the request URI to the controller & the action, so when /about is requested it executes AboutController::index method & so on
@stephen.cabreros
@stephen.cabreros 2 жыл бұрын
w0w this is so good, I didnt know this syntax [App\Classes\Invoice::class,'index']( ) would work to call its method if index method is static
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
It's just an array. I wouldn't recommend having static controller methods.
@OmarFedior
@OmarFedior 5 ай бұрын
Using XAMPP and can't get Routing to work? Try to check it out this video: kzbin.info/www/bejne/r6W5gZyPfrGtbpI Where Program With Gio explains step-by-step how to rewrite server rules.
@morteza55510
@morteza55510 Жыл бұрын
What is the difference between Home::class and new Home()?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
new creates a new object of that class, Home::class just references the fully qualified class name
@morteza55510
@morteza55510 Жыл бұрын
@@ProgramWithGio oh, thanks
@RedZambala
@RedZambala Жыл бұрын
I had big problems with this routing... First, I could not make it work at all in Laragon folder; Then, since I have a small website & domain - I tried it in subdomain, and with small adjustments (for PHP 7.3, without Composer, on a shared hosting) - I was able to make this router work in subdomain's root; but then, I was trying to make it work in a Directory, I could not make it work; or may be I failed to set .htaccess right... even though - ChatGPT could not find a problem, but it didn't work.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Sounds like a very specific issue to your setup, maybe related to Laragon. Glad you figured it out though, good job
@AhmedAdel-xg1cm
@AhmedAdel-xg1cm 2 жыл бұрын
Hi Gio, Really appreciate your efforts in explaining every minute details :) I just have a question, my dream is to be back-end dev, i studied c++, oop, data structure and algorithms, design patterns and system design and i learnt Nodejs, express and mongodb but somtething happend to me made me forget nodejs and i decided to learn php laravel so could you please tell me what i need to learn to achieve this goal ? my plan is to finish this amazing series and move to mysql and laravel so what do u think ?
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Hello. That's a good plan, you can finish the series and move on to Laravel, you can learn Laravel from Laracasts and having finished this series should help you learn Laravel faster.
@AhmedAdel-xg1cm
@AhmedAdel-xg1cm 2 жыл бұрын
@@ProgramWithGio Thank u so much for replying back to me, i really appreciate that, u are so kind and nice. u try to help people that u do even not know and for free. u are amazing :) . I hope i could be greate dev like u in the future, u are my role model
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
@@AhmedAdel-xg1cm you're welcome and thank you 💙. I'm certain you will be a better dev than me, what it takes to be a good dev is dedication and consistency and I think you got both, good luck 🤞
@AhmedAdel-xg1cm
@AhmedAdel-xg1cm 2 жыл бұрын
@@ProgramWithGio Thank you :)
@sheenismhaellim2215
@sheenismhaellim2215 3 жыл бұрын
Sir, i need to donate to your channel. You have patreon?
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Thank you. I don' have Patreon yet, best way to support me, for now, is to like my videos, comment on them & share whenever you can. That helps a lot with the algorithm to bring my videos in front of other developers. Thank you so much, I really appreciate it 🙏
@devnullex
@devnullex 3 жыл бұрын
Now he has - www.patreon.com/programwithgio
@sergeykonov4562
@sergeykonov4562 7 ай бұрын
please provide video to project with symfony and laravel(step by step)
@ProgramWithGio
@ProgramWithGio 6 ай бұрын
Thank you for your support. I'm working on Laravel course currently
@hieunguyen0801
@hieunguyen0801 3 жыл бұрын
can you guide me how to fix the syntax error, unexpected '|', variable expect(T_VARIABLE)
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
Sure, if you can show me the code I can take a look at it but that is a syntax error, check the variable name
@hieunguyen0801
@hieunguyen0801 3 жыл бұрын
public function register(string $requestMethod, string $route, callable|array $action): self {}. Vs code unexpected '|', expecting variable (T_VARIABLE)
@ProgramWithGio
@ProgramWithGio 3 жыл бұрын
@@hieunguyen0801 whats your PHP version, union types are supported in PHP8 so most likely you are on PHP 7.4 so it won't work. Remove the type hint with | character and use docblock instead
@mahmudsulemansheikhwunnam3580
@mahmudsulemansheikhwunnam3580 3 жыл бұрын
@@ProgramWithGio perfect
@abdfadee8267
@abdfadee8267 Жыл бұрын
@ProgramWithGio
@ProgramWithGio Жыл бұрын
👋👋
@69leostereo
@69leostereo 2 жыл бұрын
until watching this video ... I thought routing was kind of magic or witchcraft ... thanks.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
That's awesome, glad you found it helpful 🙌
@jeffsnow7464
@jeffsnow7464 2 жыл бұрын
Great videos as always! If you're like me and you forgot how he got all his requests to show the $_SERVER['REQUEST_URI'] variable even when he wasn't loading index.php, it's because of server configuration he did in his 1.29 video kzbin.info/www/bejne/r6W5gZyPfrGtbpI (about 11 minutes in) using mod_rewrite on the server to direct all requests to index.php.
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
Thank you. Note that we are not using Apache/xampp in section 2. We are using nginx so config is a bit different, same idea though 👍
@orenders
@orenders Жыл бұрын
@@ProgramWithGio you are using autoload.php but didnt mentioning about, nothing works from this video. Im shocked of comments, its like 99% PROs here or fake comments.
@ProgramWithGio
@ProgramWithGio Жыл бұрын
@@orenders Dude you are skipping videos, we covered autoload in episode 2.5, this is video 2.23, there is a link in the description of this video to a github repo with outline that lists all episodes. Either watch the series as its meant to be watched or just go watch somebody else's tutorial instead of stressing yourself out. This is not just a one off lesson, its entire series that is meant to be watched from beginning to the end. I cant explain every single thing in every single video, that would make having series pointless and would make each video hours long. So either move on to some other tutorials or just watch previous videos. Nothing is fake here and not everyone is pro, a lot of beginners started this course and are following along just fine.
@HeroGamingMaroc
@HeroGamingMaroc Жыл бұрын
Please gio can u do Laravel 10 full cours
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Yes, after PHP series is complete
@DigitaSkills101
@DigitaSkills101 2 жыл бұрын
How is one script running on all pages you are not even including them
@ProgramWithGio
@ProgramWithGio 2 жыл бұрын
All requests go through public/index, we set that up in Docker/nginx video
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
[RESOLVED] i don't undestand how $this->routes[$route] = ['App\Home', 'index'] would leed to a callable syntax; next in resolve method where return call_user_func($action)
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
["/invoices/create"]=> array(2) { [0]=> string(20) "App\Classes\Invoices" [1]=> string(6) "create" }
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
sr, i needed to watch several seconds further)
@EgorDemeshko
@EgorDemeshko 9 ай бұрын
call_user_func_array - from docs A method of an instantiated object is passed as an array containing an object at index 0 and the method name at index 1. Accessing protected and private methods from within a class is allowed. now it's undestandable;
@ProgramWithGio
@ProgramWithGio 9 ай бұрын
awesome, glad you figured it out. Good job
@truthteachers
@truthteachers Жыл бұрын
One of the odd things i find is that the info produced by $_SERVER differs terribly when I use xampp to run the script and when i use the PHP inbuilt server "php -S localhost:3000". I am using Windows 10 and PHP 8.1.12. This conflict becomes critical when i try to get REQUEST_URI parameter. When i use Xampp i get "/MyCoursesLG/php/courses/piocourse/src/public/" but when i use inbuilt server i get "/". This creates unnecessary coding variations especially when i tried to create basic routing. Why does this happen and how to resolve this?
@ProgramWithGio
@ProgramWithGio Жыл бұрын
Found this now, for some reason KZbin did not notify me about this. I've answered this to your comment in another video (2.25).
PHP Traits - How They Work & Drawbacks - Full PHP 8 Tutorial
31:41
Program With Gio
Рет қаралды 33 М.
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 7 МЛН
Миллионер | 3 - серия
36:09
Million Show
Рет қаралды 2,1 МЛН
Accompanying my daughter to practice dance is so annoying #funny #cute#comedy
00:17
Funny daughter's daily life
Рет қаралды 23 МЛН
Players push long pins through a cardboard box attempting to pop the balloon!
00:31
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 79 М.
PHP Attributes - Simple Router With Attributes - Full PHP 8 Tutorial
22:59
PHP Docker Tutorial - Nginx - PHPFPM VS Apache - Full PHP 8 Tutorial
14:39
When to use Traits, Interfaces, and Abstract Classes in PHP
15:08
Andrew Schmelyun
Рет қаралды 23 М.
PHP Generators Explained - Full PHP 8 Tutorial
25:47
Program With Gio
Рет қаралды 32 М.
PHP For Beginners, Ep 33 - Build a Better PHP Router
20:46
Laracasts
Рет қаралды 23 М.
Муж внезапно вернулся домой @Oscar_elteacher
00:43
История одного вокалиста
Рет қаралды 7 МЛН