0

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".

1
  • Your slashes are wrong... Commented Mar 13, 2015 at 13:16

1 Answer 1

1

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

Sign up to request clarification or add additional context in comments.

1 Comment

I have done that with giving namespace to the class1.php and directly use that at the Tournament.php like \FFMobile\Class1::method1(); its working

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.