doujiu5464 2018-07-03 21:49
浏览 100

多个require()调用VS只是一个文件较大的?

(This question is about PHP's require function, so bear with me on the set up)

I have a Wordpress theme with extensive customizations, all running through add_action or add_filter. The usual recommendation for where to place this code is your theme's functions.php files. I don't support this because it becomes a mess of unrelated code. In order to create a more organized theme, I instead organize them in directories and files based on the subject matter and it they should be trigger on the frontend or dashboard.

This means however that my functions.php file has many (many many) require('...php') calls. I've seen posts online which specifically towards the disadvantages of require_one, so I've already eliminated that.

Do you think I would have worthwhile savings in page rendering if I were to look into a way of cutting this down to 2 or 3 required files which contain the contents of all the multiple files combined.

I thought about using Grunt to contat the files (similar to how it's often done with JS files).

Thanks for the help.

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用
    • ¥15 微信小程序协议怎么写
    • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?