PHP sınıfı neden hata

0 Cevap php

Bu gerçekten kötü bir hata alıyorum. Ben PHP.net kapalı örnek sınıfları kopyalama çalıştı. Sınıf çalıştı ama doğru eklemek için almak gibi olamaz. Benim dizin dosyası users.class.php ve daha sonra sınıfa çağrı vardır content.php içerir.

Hata:

Fatal error: Class 'A' not found in X:\xxxxx\xxxx\xxxxx\content.php on line 2

index.php:

<?php
   require('users.class.php');
   $a = new A();
   require('content.php');
?>

content.php:

<?php
   echo $a->foo();
?>

users.class.php:

<?php
   class A
   {
      function foo()
      {
         return 'hello world';
      }
   }
?>

0 Cevap