Welcome Guest, Not a member yet? Register   Sign In
Class not found Error, problem with namespaces
#1

I'm new to Codeigniter 4 and am struggling with namespaces. I tried to create a helper php2jquery.php in App/Helpers I cannot load it the way I try it. This is wat I have now.
PHP Code:
<?php namespace App\Controllers;
use 
App\Helpers\php2jquery;
class 
Test extends BaseController
{

    public function 
index()
    {
        
        
$param “”//Doesn’t matter here ;
        
        
$jqueryparam = New php2jquery();
    
        
$data[‘jqueryobject’] = $jqueryparam->php_array_to_jquery_param($param4"new FWDRAP""FWDRAPUtils.onReady(function(){" );
        
        
$data['base'] = config('App')->baseURL;
        return 
view('test_message',$data);
    }

    
//--------------------------------------------------------------------

}

————
File
App/Helpers/php2jquery.php  (Also tried App/Helpers/php2jquery_helper.php
__________
<?php
    
class php2jquery
    
{
        
        function 
php_array_to_jquery_param($param,$indent=0$object=""$wrapfunction=""){
            Return (
“this is a test”);
        }


Now, when I run it I get "Error: Class App\Helpers\php2jquery not found" I tried adding _helper tot the name and call it with and without it, but no luck. Can somebody tell me what is wrong? Thank you
Reply


Messages In This Thread
Class not found Error, problem with namespaces - by music_ed - 11-30-2020, 09:12 AM



Theme © iAndrew 2016 - Forum software by © MyBB