加载特定功能的PHP [英] Load specific functions PHP

查看:35
本文介绍了加载特定功能的PHP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在整个站点上都有一个单一的功能文件,并且在给定单个页面的情况下,甚至没有调用该文件的90%.因此,我只想加载页面中调用的功能,而我是php的新手.

I have a single functions file for my entire site and given a single page 90% of the file is not even called. So i want to load only the functions which are called in the page and i am new to php.

推荐答案

通过使函数成为静态函数,将它们组合为具有共同特征的几个对象,并将每个对象放在单独的文件中.然后使用PHP5自动加载功能仅在使用适当的对象时加载它们.

Group functions together into several objects with common traits, by making them static functions, and put each object in a separate file. Then use PHP5 autoloading functions to load appropriate objects only when they are used.

这篇关于加载特定功能的PHP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆