Помощь по скриптам | помощь по коду
Avenax, вот поставил твой код
$config = [
'db' => [
'host' => 'localhost',
'name' => 'admin',
'user' => 'admin',
'pass' => 'и не пашет'
]
];
$config = [
'db' => [
'host' => 'localhost',
'name' => 'admin',
'user' => 'admin',
'pass' => 'и не пашет'
]
];
DNR_RUS, версия php какая? Может array() надо юзать?
DNR_RUS,
$config = array(
'db' => array(
'host' => 'localhost',
'name' => 'admin',
'user' => 'admin',
'pass' => 'и не пашет'
)
);
SparkuS, теперь зайди на сайт другая ошибка
<?php
class Router
{
private $class;
private $action;
public function __construct ($RouteGet)
{
$exp = explode ('/', $RouteGet);
$this->Controller = $exp[0];
$this->Action = !empty ($exp[1]) ? $exp[1] : NULL;
$file = H . 'app/' . $this->Controller . '/index.php';
if (!ROUTER)
{
$this->Controller = 'index';
$this->Action = 'main';
$this->run().exit();
}
if (!file_exists($file))
{
$this->Controller = 'error';
$this->Action = 'main';
$this->run().exit();
}
$this->run().exit();
}
public function run()
{
$class = $this->Controller;
$action = $this->Action;
$file = H . 'app/'.$this->Controller . '/index.php';
if (!file_exists ($file))
{
$class = 'index';
$action = 'main';
}
require_once $file;
$controller = new $class;
if (is_callable([$controller, $action]) == false)
{
$action = 'main';
}
$controller->$action();
}
}
<?php
class Router
{
private $class;
private $action;
public function __construct ($RouteGet)
{
$exp = explode ('/', $RouteGet);
$this->Controller = $exp[0];
$this->Action = !empty ($exp[1]) ? $exp[1] : NULL;
$file = H . 'app/' . $this->Controller . '/index.php';
if (!ROUTER)
{
$this->Controller = 'index';
$this->Action = 'main';
$this->run().exit();
}
if (!file_exists($file))
{
$this->Controller = 'error';
$this->Action = 'main';
$this->run().exit();
}
$this->run().exit();
}
public function run()
{
$class = $this->Controller;
$action = $this->Action;
$file = H . 'app/'.$this->Controller . '/index.php';
if (!file_exists ($file))
{
$class = 'index';
$action = 'main';
}
require_once $file;
$controller = new $class;
if (is_callable([$controller, $action]) == false)
{
$action = 'main';
}
$controller->$action();
}
}
DNR_RUS, поднеми версию пхп до 7 или юзай другой скрипт. Ошибка в квадратных скобках, в 5.4 использовали array()
DNR_RUS, тогда заменяй все массивы, хотя там и другие ошибки могут выскочить
if (is_callable(array($controller, $action)) == false)
if (is_callable(array($controller, $action)) == false)
DNR_RUS, в коде что ты скинул
Стр.: 1, 2