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?