本文整理汇总了PHP中HomeController类的典型用法代码示例。如果您正苦于以下问题:PHP HomeController类的具体用法?PHP HomeController怎么用?PHP HomeController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了HomeController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct()
{
$url = isset($_GET['url']) ? $_GET['url'] : null;
$url = rtrim($url, '/');
$url = explode('/', $url);
if (empty($url[0])) {
require 'Controller/HomeController.php';
$controller = new HomeController();
$controller->index();
return false;
}
$file = 'Controller/' . ucfirst($url[0]) . 'Controller.php';
if (file_exists($file)) {
require $file;
} else {
throw new Exception("The file: {$file} Does not exists");
}
$controller_url = ucfirst($url[0]) . "Controller";
$controller = new $controller_url();
// Carregando o Modelo
$controller->loadModel($controller_url);
// Verificar se foi especificado um método (action)
if (isset($url[2])) {
// adicionar parametro no método
$controller->{$url[1]}($url[2]);
} else {
if (isset($url[1])) {
$controller->{$url[1]}();
} else {
$controller->index();
}
}
}
示例2: logout
public function logout()
{
session_start();
session_unset();
$home = new HomeController();
return $home->index();
}
示例3: save
function save()
{
include "config/site.php";
if ($commentswitch === "0") {
echo "-1";
return;
}
session_start();
if (strcasecmp($_POST['validationCode'], $_SESSION['validationCode']) != 0) {
echo "0";
return;
}
$this->reply = new Reply();
$this->reply->save();
include "config/site.php";
$model = new BaseModel();
//reconnect to the msyql
$fname = $tpl_root . "/static/" . $_POST['par_id'] . ".html";
ob_start();
$_GET["id"] = $_POST['par_id'];
$home = new HomeController();
$home->info();
$content = ob_get_contents();
ob_end_clean();
$fp = fopen($fname, "w");
fwrite($fp, $content);
fclose($fp);
echo "true";
}
示例4: fire
/**
* Execute the console command.
* Creates a HomeController and calls its cleanLeases function which terminates all expired leases.
*
* @return mixed
*/
public function fire()
{
$home_controller = new HomeController(new LaravelDuo\LaravelDuo());
$cleaner = $home_controller->cleanLeases();
if ($cleaner) {
$this->info($cleaner);
}
}
示例5: showFellowSelect
public function showFellowSelect($city_id)
{
$fellowName = "Propel Fellow";
$home = new HomeController();
$year = $home->get_year();
$fellows = Group::where('name', '=', $fellowName)->first()->fellow()->distinct()->where('city_id', '=', $city_id)->where('year', '=', $year)->where('status', '=', '1')->where('user_type', '=', 'volunteer')->get();
//return $fellows;
return View::make('city.select-fellow')->with('fellows', $fellows);
}
示例6: foundController
public function foundController()
{
if ($this->url == "home") {
$controller = new HomeController();
$controller->index();
} elseif ($this->url == "conversor") {
$controller = new ConversorController();
$controller->index();
}
}
示例7: GET
function GET($matches)
{
$home = new HomeController($matches);
if (array_key_exists(1, $matches)) {
if ($matches[1] == "json") {
$home->renderJson();
}
} else {
$home->render();
}
}
示例8: HomeAction
public static function HomeAction()
{
if (!isset($_SESSION["usuarioActual"])) {
HomeController::LoginAction();
return;
}
require_once './views/Home/index.php';
}
示例9: perguntasSemelhantes
public function perguntasSemelhantes($texto)
{
$perguntas = DB::table('perguntas')->orderBy('data_hora', 'desc')->get();
$arRetorno = array();
foreach ($perguntas as $pergunta) {
if (HomeController::cosineSimilarity($texto, $pergunta->pergunta)) {
array_push($arRetorno, $pergunta);
}
}
return Response::json($arRetorno);
}
示例10: __construct
/**
* "Start" the application:
* Analyze the URL elements and calls the according controller/method or the fallback
*/
public function __construct()
{
// create array with URL parts in $url
$this->splitUrl();
// check for controller: no controller given ? then load start-page
if (!$this->url_controller) {
require APP . 'controller/home.php';
$page = new HomeController();
$page->index();
} elseif (file_exists(APP . 'controller/' . $this->url_controller . '.php')) {
// here we did check for controller: does such a controller exist ?
// if so, then load this file and create this controller
// example: if controller would be "car", then this line would translate into: $this->car = new car();
require APP . 'controller/' . $this->url_controller . '.php';
$controller = ucfirst($this->url_controller) . 'Controller';
$this->url_controller = new $controller();
// check for method: does such a method exist in the controller ?
if (method_exists($this->url_controller, $this->url_action)) {
if (!empty($this->url_params)) {
// Call the method and pass arguments to it
call_user_func_array(array($this->url_controller, $this->url_action), $this->url_params);
} else {
// If no parameters are given, just call the method without parameters, like $this->home->method();
$this->url_controller->{$this->url_action}();
}
} else {
if (strlen($this->url_action) == 0) {
// no action defined: call the default index() method of a selected controller
$this->url_controller->index();
} else {
header('location: ' . URL . 'error');
}
}
} else {
header('location: ' . URL . 'error');
}
}
示例11: _initialize
public function _initialize()
{
parent::_initialize();
$this->assign('check_all', false);
$this->assign('search_url', U('lists'));
define('ADDON_PUBLIC_PATH', '');
defined('_ADDONS') or define('_ADDONS', MODULE_NAME);
defined('_CONTROLLER') or define('_CONTROLLER', CONTROLLER_NAME);
defined('_ACTION') or define('_ACTION', ACTION_NAME);
$this->model = M('model')->getByName('public');
$this->assign('model', $this->model);
// dump ( $this->model );
$res['title'] = $this->model['title'];
$res['url'] = U('lists');
$res['class'] = ACTION_NAME != 'help' ? 'current' : '';
$nav[] = $res;
// $res ['title'] = '管理员配置';
// $res ['url'] = U ( 'Home/Admin/lists' );
// $res ['class'] = '';
// $nav [] = $res;
if (ACTION_NAME == 'help') {
$res['title'] = '接口配置帮助';
$res['url'] = U('help', array('public_id' => $_GET['public_id']));
$res['class'] = 'current';
$nav[] = $res;
}
$this->assign('nav', $nav);
}
示例12: getInstance
public static function getInstance($params = array())
{
if (!self::$instance instanceof self) {
self::$instance = new self($params);
}
return self::$instance;
}
示例13: display
/**
* 模板显示 调用内置的模板引擎显示方法,
* @access protected
* @param string $templateFile 指定要调用的模板文件
* @return void
*/
protected function display($template)
{
$file = T('Addons://' . parse_name($_GET['_addons'], 1) . '@./' . ucfirst($_GET['_controller']) . '/' . $_GET['_action']);
define('IS_ADDON', true);
parent::display($file);
// 重要:要避免陷入$this->display()循环
}
示例14:
function __construct()
{
parent::__construct();
$this->uid = is_login();
if (!$this->uid) {
$this->redirect('User/login');
}
}
示例15: _initialize
public function _initialize()
{
parent::_initialize();
$this->Notice = M('notice');
$this->Ndetail = M('noticeDetail');
$this->Youpin = M('youpin');
$this->Ydetail = M('youpinDetail');
}