문제

I have an issue where I seem to be unable to load a namespace that I have created. I have read a bit about namespaces on SO, but I can't see what I am missing in this case.

This is my calling code:

<?php

use \CRMPicco\User\AlertReminder;
$alert_reminder = new AlertReminder($userObj);

?>

This is my namespaced code:

<?php
namespace CRMPicco\User;

class AlertReminder
{

}

This is my error:

Fatal error: Class 'CRMPicco\User\AlertReminder' not found in /var/www/vhosts/dev/web/login.inc.php on line 324

Line 324 is the new AlertReminder line.

도움이 되었습니까?

해결책

This was due to some classname cleansing in my custom autoloader, which prevented the class from loading.

I refactored the class into another package and it now works as expected.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top