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.