کد PHP:
<?php
require("libs/Controller.php");
require("libs/view.php");
require("libs/Bootstrap.php");
$app = new Bootstrap();
?>
libs/Controller.php:
کد PHP:
<?php
class Controller
{
function __construct()
{
//echo "<br>Main Controller<br>";<br />
$this->view=new View();
}}
?>
کد PHP:
<?php
class View
{
function __construct()
{
//echo "<br>we are in page View";
}
function Render($name)
{
require("Views/Header.php");
require("views/".$name.".php");
require("Views/Footer.php");
}
}?>
کد PHP:
<?php
class Bootstrap{
function __construct()
{
if(!isset($_GET['url']))
{
$url = 'index';
}
else
{
$url = $_GET['url'];
}
$url = explode('/', $url);
//print_r($url);
if(!file_exists("Controllers/".$url[0].".php"))
{
echo "Not Found Page";
}else{
$file="Controllers/".$url[0].".php";
require($file);
$controller=new $url[0]();
}
}
}
?>
index.php که این کد ها توش هستش
کد PHP:
<?php
class Index extends Controller
{
function __construct()
{
parent::__construct();
//echo "<br>Page Index ";
$this->view->Render("Index/index");
}
}
?>
یا حتی اینجوری
اما نمیدونم چرا به این شکل که باز میکنم ایراد دارم :
لطف کنید یه راهنمایی بکنید ممنونم .
http://localhost/KCMOS/images/p12.jpg
اما در حالت آخر اینجوری :
http://localhost/KCMOS/index/images/m1-1.gif
این برای صفحه index بود مثلا اگه about us رو بزنم اینجوری میشه :
http://localhost/KCMOS/about/images/m1-1.gif
و باز نمایش نمیده ...
ممنون
php مرکز کد های سایت...برچسب : نویسنده : استخدام کار phpco بازدید : 149