search

Home  >  Q&A  >  body text

A Class is clearly created, but when referenced in another php file, it prompts class not found!

Error message:

Fatal error: Uncaught Error: Class 'frameworkdbMysqli' not found in C:Users11500DesktopdemoProjecttestTest.php:7 Stack trace: #0 {main} thrown in C:Users11500DesktopdemoProjecttestTest.php on line 7

Project directory:

Class file:

Another php file:

世界只因有你世界只因有你2750 days ago975

reply all(3)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-16 09:20:31

    You didn’t import the file, so PHP certainly doesn’t know where your class definition is = =

    require '../db/Mysqli.php';

    Add

    at the beginning of the test file

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-16 09:20:31

    Requires SPL loader

    <?php
    spl_autoload_register(function ($class) {
        include 'classes/' . $class . '.php';

    reply
    0
  • 某草草

    某草草2017-06-16 09:20:31

    For example,
    use I want to use Huashan Sword Sect Dugu Nine Swords instead of Huashan Qi Sect Dugu Nine Swords

    Of course, the prerequisite for you to use it is that you have it, everything is required

    reply
    0
  • Cancelreply