Laravel 4:我如何理解它们的工作原理? [英] Laravel 4: how can I understand how it all works?
问题描述
我在一个项目中使用Laravel 3,这真是一件乐事.我还多次查看了源代码,以了解某些事情在后台进行.
I am using Laravel 3 in one project and it's been a joy. I have also looked at the source code several times to see how some things work behind the scenes.
但是现在在Laravel 4中,我不知道从哪里开始或如何理解这一切.在哪里可以了解Laravel 4的所有幕后知识?
But now in Laravel 4, I don't know where to begin or how to understand it all. Where can I learn all the behind the scenes of Laravel 4?
要点:我想找出DB::insert()
是否返回插入行的ID.所以我开始搜寻.
1.我找到了封装"数据库的Illuminate \ Support \ Facades \ Facade类.
2.调用resolveFacadeInstance函数,然后尝试打印这些数组,但是我的计算机挂起了:-/.而且我敢肯定,这将导致我不理解的更多类.
Case in point: I wanted to find out if the DB::insert()
returns the id of inserted row. So I started searching.
1. I found the Illuminate\Support\Facades\Facade class that "encapsulates" DB.
2. The resolveFacadeInstance function is called and then I tried to print these arrays, but my computer hangs :-/. And I'm sure this would lead to many more classes that I wouldn't understand.
有没有办法我可以学习Laravel 4的内部运作方式?也许是堆栈痕迹?
Is there a way I could try to learn the inner workings of Laravel 4? Maybe stack traces?
推荐答案
facade类只是一个过滤器类,可让您像静态方法一样调用方法. 有关外观的映射,请访问此处: http://laravel.com/docs/facades#facade-类引用
The facade class is just a filter class to allow you to call methods as if they were static. For the facade mappings go here: http://laravel.com/docs/facades#facade-class-reference
全面了解laravel内部工作的起点应该始于:
The starting point to fully understand laravel's inner-workings should begin at:
/public/index.php
您可以遵循程序的逻辑,注意需要start.php,该文件将加载应用程序"的实例,该实例位于以下位置:
You can follow the logic of the program, noticing that requires start.php, which loads an instance of the "Application" which is found here:
/vendor/laravel/framework/src/Illuminate/Foundation/Application.php
这篇关于Laravel 4:我如何理解它们的工作原理?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!