What should I do before php namespace? Space wedding photo album naming. Space album naming. QQ space album naming.

WBOY
Release: 2016-07-29 08:53:06
Original
1456 people have browsed it

I encountered a problem when connecting to the database today. For example, new PDO() would cause a class not found error. Generally, if we write our own class and load it automatically, there will be no problem, but this is a built-in function of PHP. ,what to do? Automatic loading can't load it either.

Consider 1: Add a layer, write a PDO yourself, then encapsulate each method, call the PDO in this obvious space, and then this PDO calls the built-in PDO.
Conclusion: No problem has been solved at all. How to call the built-in PDO? It must be able to be called and used directly!
Consideration 2: Use the process-oriented method to write a function in a file, return a PDO object after calling it, and then import this file
Conclusion: It works, but it’s ugly and has a weird style
Consideration 3: Dig the ancestral grave and find the built-in PDO namespace.
Conclusion: Perfect, the built-in functions and objects with the namespace ""

php are all in the default global space, and all those that do not use namespace to declare the namespace are also in the global space

').addClass('pre-numbering' ).hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

The above introduces what to do before PHP namespace, including namespace and PHP content. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!