A PHP file that registers many functions and the code looks messy. How to logically classify these functions

Source: Internet
Author: User
How to arrange it in a structured way?

Reply content:

How to arrange it in a structured way?

Why do you have to write to a file, not abstract it ~

1 Considering Oo
2 functions of similar classification, such as the string operation class strings.fuc.php date.fuc.php

__autoload

Unified into the functions.php, it should be more convenient to find, text editor such as Geany can all the functions of a file in the sidebar listed and smart tips. Many programs are like this, the key is to properly plan the prefix , such as PUNBB, Avoid naming conflicts. For example, 3 people (A,B,C) jointly develop a PHP project. Unified by owner A in common.php contains Functions.php,functions_b.php,functions_ C.php. Other developers only edit their own function files. The same is true of the style sheet in the view, which is introduced by the owner in the header.php Style.css,style_b.css,style_c.css. Container for each page is fast, Use a unique class to differentiate, such as the article page. Cat-post. Title {}, login page. Cat-login. Title {}. With these "prefixes", you can avoid different pages. Title style interaction.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.