Uncaught Error: Class "APP\Utilities\Asset" not found in - php

In the asset file in utilities, I put the namespace APP\Utilities correctly, but when I use the asset::get() object, for example, it gives an error.
#Meanwhile, I am just learning MVC :)

Related

Fatal error: Class 'Subject' not found. Am I calling the class wrong?

The OO PHP displays an error "Fatal error: Class 'Subject' not found " when I open browse.php file that calls the class Subject, the fatal error pops up, my guess is that I'm calling the class wrong.
initialize.php
require_once('browse.php');
require_once('class_Subject.php');
browse.php
$subject_array = Subject::find_all();
If you are not using factory design pattern, you need:
$Subject = new Subject();
then you can call any functions like:
$Subject->find_all()
To write it more in the style that you're implying, you need to apply the factory design pattern. Checkout calling class method (with constructors) without object instantiation in php
You need to show how your class is written to determine what kind of design pattern you are using, as this affects how you instantiate the class. This would make it easier to get help.

Class not found [laravel]

I am using laravel 5.5, I want to use CrondJobs but none of my classes found in my php file
//This Is My Name Space
namespace App\Http\Controllers\Crons;
//Using Jalali but Class Not Found
$date =\Morilog\Jalali\Jalalian::now()->format("Y/m/d " );
This is my error in my error_log
PHP Fatal error: Uncaught Error: Class 'Morilog\Jalali\Jalalian' not
found in /home/micacoco/crons/cron.php:29
The possible causes of this error can be:
Class doesn’t exist
The class name case is not the same for example - Jalalian.php and jalalian.php are not the same even when the class name case is the same check to confirm that the 'use' statement has the right letter case.
wrong namespace

PHP5.5: Fatal error: Cannot redeclare class

since I upgraded from PHP 5.2 to 5.5 I get an error I don't understand by now.
Fatal error: Cannot redeclare class sessionHandler in ... on line ...
Well before updating the PHP version this error didn't raise and redeclaring a class should be an error independent from PHP version as I guess. Further I always use require_once() which should help to avoid a mistake on that.
So just to make sure it doesn't be redeclared, I added a backtrace code block before that class declaration. So hopefully, I thought it would output twice, but I get only one backtrace output at all. Therefore it gets declared only once from my point of few.
Do I miss something? Any idea how to find the "real" issue?
Class "SessionHandler" already exists in the namespace as it's a class in PHP - http://php.net/manual/en/class.sessionhandler.php
Looks like the class was included in PHP 5.4 so it explains everything.
Try to think of some other name for the class or define a namespace.
If you create a namespace, something like..
namespace App;
class sessionHandler {
....
you won't get the error anymore but you will need to use App\sessionHandler whenever you're referring to your own class.

Call of unknown method register_block in Smarty

I'm using the last version of Smarty, I'm tring to register a block but I get the follow error:
Fatal error: Uncaught exception 'SmartyException' with message 'Call
of unknown method 'register_block'.
I just extended Smarty in my class and then:
$this->register_block('myTag', 'myFunction');
Why?
register_block() is Smarty2 API. You're looking for registerPlugin() in Smarty 3. You also have the option of using the backward compatibility layer SmartyBC
Did you extend Smarty or Smarty_Compiler (I'm not using latest so you need to check what classes there are)
on my older version class Smarty_Compiler extends Smarty {
so you'd need to change it to class Smarty_Compiler extends MySmartyVersion {
You could create or amend a plugin to do what you want to do.

Codeigniter extending exception class

I am trying to load a custom exception class that I created according to the instructions here:
http://codeigniter.com/user_guide/general/core_classes.html
MY_Exceptions.php is stored at application/core/
Somehow, when I try loading it, I keep getting this error:
Fatal error: Class 'MY_Exceptions' not found in C:\xampp\htdocs\xampp\facebook\application\models\campaign_model.php on line 29
Based on the instructions, it doesn't say I have to autoload the class or anything. What am I doing wrong?
MY_Exception.php is stored at application/core/
Name the class and file MY_Exceptions with an s
You do not need to autoload or manually load anything in the core directory, nor should you. They are required classes for CI to run that are automatically loaded.
For creating core classes, use this documentation instead: http://codeigniter.com/user_guide/general/core_classes.html
Keep in mind that when calling the class you will use the original class name. Let's say you have created MY_Input. Example:
$this->input->post(); // Do this
$this->my_input->post(); // Don't do this
To understand the why and how, see system/core/Common.php function load_class.
Looking at the docs now, I agree that this should probably be highlighted.
It's trying to find MY_ExceptionS.php, not MY_Exception.php.

Categories