Let's get started.

Source: Internet
Author: User
For example, write an infinite navigation class PHPcodearray (array ('id' = & gt; 1, 'pid '= & gt; 0, 'name' = & gt; 'homepage') and array
For example, write an unlimited navigation class.
PHP code
  Array ('id' => 1, 'pid '=> 0, 'name' => 'homepage'), array ('id' => 2, 'pid '=> 0, 'name' => 'news ')


Data such as this is read when class attributes exist or need to be read in the initialization class (database or file). The key is to consider the memory efficiency which is better.
Note:
1. frequent calls due to navigation
2. there will be more data, with a tree structure greater than 3. it is estimated that there will be 6 data records.


------ Solution --------------------
It is better to read in when necessary, and the speed and performance will be relatively high
Http://baike.baidu.com/view/1617569.htm
------ Solution --------------------
Discussion
For example, write an unlimited navigation class.
PHP code

Array (
Array (
'Id' => 1,
'Pid '=> 0,
'Name' => 'homepage'
),
Array (
'Id' => 2,
'Pid '=> 0,
'Name' => 'news'
)


------ Solution --------------------
Most of this navigation is related to directories and files, and maintenance is required in the future. Therefore, the data correspondence should be stored through the database.
Then, generate a file and include the file as needed.
------ Solution --------------------
Write cache. if memcached exists, write it directly. Otherwise, the file cache can also be used.
------ Solution --------------------
Discussion
Write class attributes (initialization exists), and load as needed (will certainly be loaded, but it should be said that it is slightly later than the class attributes), except for the time difference, are there any other differences?

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.