I want to imitate this method of calling. How should I write it?

public function exchangeComponentAccessToken(){
        $values["config"]["app_id"] = "xxx";
        $values["config"]["secret"] = "xxx";
        $values["config"]["verify_ticket"] = "xxxx";
        $app = new Container($values); //
        
        $AccessToken = new AccessToken($app);

    }
//$this->app 
return [
            "component_appid" => $this->app["config"]["app_id"],
            "component_appsecret" => $this->app["config"]["secret"],
            //,,,
            "component_verify_ticket" => $this->app["verify_ticket"]->getTicket(),
];
Aug.30,2021

first of all, your call is $this- > app ['verify_ticket']-> getTicket () , indicating that $this- > app [' verify_ticket'] must store an instantiated object. Cannot be a closure or function.

can be implemented with a class.

class A
{
    public function getTicket()
    {
        return 'aaa';
    }
}

$c = new A();


$data['verify_ticket'] = $c;

echo $c->getTicket();

either use anonymous methods directly, but you can't call -> in this way:

$data['verify_ticket']['getTicket'] = function(){
        return 'aaa';
    };
//

$data['verify_ticket']['getTicket']();

is that what you want?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3e3d4-2c3f4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3e3d4-2c3f4.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?