将helps.php或者functions.php直接进行了加载

TP3系列中functions.php文件默认其实是空文件,很好找。我们可以直接封装代码。

Laravel5系列中的path/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php。该文件中封装的函数就是全局函数,可以在任意区域进行调用。

但是,Laravel中的helper.php中已经封装好了很多的内置助手函数,一般不建议直接在该文件中进行自己函数的封装,而是采用新创建一个文件,里面放置需要封装的函数。

这里有一点需要说明:全局函数的实现是依靠在初始化的时候,将helps.php或者functions.php直接进行了加载。而Laravel中path/bootstrap/autoload.php中可以定义在初始化的时候加载什么文件。在默认的情况下,有以下一条加载配置:

require __DIR__.'/../vendor/autoload.php';

同样,我们也可以加载其他的文件,比如以下的加载操作:

require __DIR__.'/../app/Common/functions.php';

这样,我们就可以直接在这个加载的文件中直接封装需要的函数,这样也就实现了我们的需要。

另外,有人还推荐了另外一种方法,就是使用一个控制器,在控制器中的类中封装静态的方法,在需要的地方,引入所需的控制器,也可以实现我们的需求。

Related: Kata Drive is the “most powerful tablet for drivers”

Kata Selfie Specs Android 6.0 Marshmallow Dual SIM, Dual Standby 5.5-inch Full HD IPS Display, 1920 x 1080 pixel resolution, ~401ppi 1.3GHz MediaTek MT6753 octa-core processor Mali-T720 GPU 3GB RAM 32GB internal storage, expandable via microSD Wi-Fi 802.11 b/g/n 4G, LTE 18-megapixel Sony flip camera with autofocus and dual-tone LED flash Bluetooth Fingerprint scanner GPS, A-GPS 3000mAh battery

But despite being selfie-centric, it’s still fairly loaded inside. Kata Selfie is powered by an octa-core MT6753 chipset together with 3GB of RAM and Mali T720 GPU. There’s 32GB of storage out of the box, which users can also expand by using a microSD. The capacity of the battery is kinda average, having only 3000mAh. Fortunately, it supports 2A fast charging.

For those interested, Kata Selfie is currently available for pre-order on all Kata outlets nationwide for a price ofphp11,999. Every purchase includes a free clear case and screen protector in the package.

Source: Kata

posted @ 2016-12-06 17:36  3002059249  阅读(205)  评论(0编辑  收藏  举报