Controller:
<?php namespace Application\Controller; use Zend\Mvc\Controller\AbstractActionController; use Zend\View\Model\ViewModel; use Application\Common\CommonServices; use Application\Common\MySQL; class IndexController extends AbstractActionController{ var $sqln; public function __construct() { $this->$sqln=new MySQL(); $this->$sqln->connect("localhost",'root','ввв','222'); } MySQL class:
<?php namespace Application\Common; class MySQL { var $idsqlconnection; var $query_result; var $num_queries = 0; function connect($host, $name, $pass, $base,$codemysql="utf8"){ $this->idsqlconnection = new mysqli($host, $name, $pass, $base); ... When you call the $ this -> $ sqln-> connect command from __construct (), connect ("localhost", 'root', 'wbv', '222') ;, Zend Framework 3 crashes with the error:
Error File: /var/www/webuseorg4/module/Application/src/Common/MySQL.php:22 Message: Class 'Application\Common\mysqli' not found