Bhavik Joshi
Bhavik Joshi

Reputation: 2677

Php Class not Found (Zend)

I am getting an error Php Class not Found (Zend)

My Folder Hierarchy :

/FFMobile(main Folder)
    /Controller(Folder)
    /Model(Folder)
         /Tournament.php
    /class1.php
         /method1();
    /class2.php
         /method2();

My goad is to access Class1 and class2 in Tournament.php

ATM I am trying to access them in a following way

$data1 = /class1::method1();
$data2 = /class2::method2();

but I am not able to access the classes I am getting error message "Class not Found".

Upvotes: 0

Views: 131

Answers (1)

Unex
Unex

Reputation: 1757

Have you required those class in you Tournament.php ?

You can do it with the use command.

Moreover I suggest not using the scope operator :: only to call 1 method, we usually do that when we want to call a parent::method.

You should instantiate de class and then call the method.

$class1 = new \class1();
$data1 = $class1->method1();
$class2 = new \class2();
$data2 = $class2->method2();

Hope this will help you

Upvotes: 1

Related Questions