DiscuzX single-piece mode. This article introduces an original article about discuzX single-piece mode. the PPC highlight plug-in is too unfriendly. it may be strange to paste txt content directly. As long as there are articles at the beginning of the file about a single-piece mode original article about discuz X, PPC highlight plug-in is too unfriendly, I directly paste txt content will have a strange problem.
As long as there is such a sentence at the beginning of the file
| The code is as follows: |
|
$ Discuz = & discuz_core: instance (); [Code language = php] // Instance () belongs to the discuz_core class in class_core.php Function & instance (){ Static $ object; If (empty ($ object )){ $ Object = new discuz_core (); } Return $ object; } [/Code] Make sure that a discuz_core instance is used for all word requests. Here, & is written to be compatible with PHP4. if it is in PHP5, you can use static. [Code language = php] // Here is a simple example of the single-piece mode. Class PHPig { Private static $ v = null; Static function instance (){ If (self: $ v = null ){ Self: $ v = new PHPig (); } Return self: $ v; } } $ Pig1 = PHPig: instance (); $ Pig2 = PHPig: instance (); If ($ pig1 ===$ pig2 ){ Echo 'same object '; } Else { Echo 'not the same object '; } [/Code] |
The PPC highlight plug-in is too unfriendly for original articles in the single-piece mode of ipvx. it is strange to paste txt content directly. X, as long as the file starts...