A problem with a PHP namespace is a very non-language problem.

Source: Internet
Author: User
Just a little bit of code.


   

 
   Assign (' name ', ' Ned '); $smarty->debugging = true; $smarty->display (' Index.tpl ');? >


Code as above, very simple, two pieces of code of the file structure in the same directory

In this way, the operation can not find the class .....
Fatal error:class ' smarty\smarty_test ' is not found in .....
I really do not understand, I am in the thinkphp framework is also using the namespace completely no problem, how to create a new project to put a file, test it is not good or dead .... Even Zend Studio editor can show the existence of smarty_test this class, how to run the time is not,, depressed AH


Reply to discussion (solution)

No one .........

Very good LLL

You did not load the file containing the Smarty_test class definition

You did not load the file containing the Smarty_test class definition



How do I load? Use the include include?

Yes, include included in
or set automatic loading

Spl_autoload_register (); Use smarty\smarty_test; $smarty = new Smarty_test (); $smarty->assign (' name ', ' Ned '); $smarty->debugging = true; $smarty->display (' Index.tpl ');
  • 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.