Warning: Cannot use a scalar value as an array in /home/admin/public_html/forum/include/fm.class.php on line 757

Warning: Invalid argument supplied for foreach() in /home/admin/public_html/forum/include/fm.class.php on line 770
Форумы портала PHP.SU :: Версия для печати :: не видит метод
Форумы портала PHP.SU » » Вопросы новичков » не видит метод

Страниц (1): [1]
 

1. corname - 14 Декабря, 2018 - 18:14:07 - перейти к сообщению
index.php

<?php

define('BASE_DIR', getcwd());

require './framework/core/bootstrap.php';

$app = new AndreEngine(require('settings.php'));
echo($app->app);

settings.php

<?php

return array(
'debug' => false,
'apps' => array(
'Simple_Pages'
)


);

urls.php

<?php

return array(
'/^*$/' => 'MainPage'
);

bootstrap.php

<?php


class AndreEngine
{

public
$settings, //settings
$uri, //current URI
$app; //current app

public function __construct($settings)
{
$this->settings = $settings;
$this->uri = urldecode(preg_replace('/\?.*/iu','', $_SERVER['REQUEST_URI']));
$this->app = false;
$this->process_path();
}
public function process_path()
{
foreach ($this->settings['apps'] as $iterable_app) {
$iterable_urls = require(BASE_DIR . '/apps/' . $iterable_app . '/urls.php');
foreach ($iterable_urls as $pattern => $method) {
if(preg_match($pattern, $this->uri)) {
$this->app = array($iterable_app, array('pattern' => $pattern, 'method' => $method));
break(2);
}
}
}
if ($this->app === 'false') {
exit('App not found!');
}
}


при загрузке index.php пустая страница. к другим методам я обращаюсь и всё видит.

 

Powered by ExBB FM 1.0 RC1