切换风格

默认 晚霞 雪山 粉色心情 伦敦 花卉 绿野仙踪 加州 白云 星空 薰衣草 城市 简约黑色 简约米色 龙珠
1.6.6版本的框架好像不能自定义控制器的路径?
 4422     2
发表于 2017-4-23 |

用HYPHP 1.6.6自定义Action的路径时会报错“Fatal error: Class '\Action\Index' not found in D:\phpStudy\WWW\HY\HY\HY.php on line 187”;

在单入口文件定义后这样报错,就是修改HY文件也是一样;

defined('ACTION_PATH')  or define('ACTION_PATH',   PATH.'app/'); //Action目录


发表于 2017-4-26 |

1.6框架后 Action类 不需要再增加 Action名称

IndexAction 改为Index

发表于 2017-4-28 |

还是不行呀?

以下为入口文件index.php代码

<?php

if(version_compare(PHP_VERSION,'5.3.0','<'))die('You Need PHP Version > 5.3.0 ! , You PHP Version = ' . PHP_VERSION);

define('INDEX_PATH' , str_replace('\\', '/', dirname(__FILE__)).'/');
define('ACTION_PATH', INDEX_PATH.'Apps/');//控制器目录
define('DEBUG'      ,true);
require './HY/HY.php';

以下为生成的apps文件夹下的index.php代码

<?php 
namespace Action;
use HY\Action;
class Index extends Action {
public function Index(){
echo 'HY框架';
}
}

输出显示

Fatal error: Class '\Action\Index' not found in D:\USBWebserver\root\HYPHP\HY\HY.php on line 187

GMT+8, 2024-05-20 10:39:48 运行耗时 0.0102 秒.

Powered by HYBBS 2.3.4

© 2016-2019 HYBBS

返回顶部