Authored by whb

去掉Bom

<?php
<?php
/**
* 启动运行
*
... ... @@ -66,19 +65,21 @@ class Bootstrap extends Bootstrap_Abstract
{
$hostParts = explode('.', $dispatcher->getRequest()->getServer('HTTP_HOST', ''));
$level = count($hostParts) - 1;
/* 根据域名的级别,设置默认的模块、控制器、方法 */
$module = 'Index';
$controller = 'Index';
$action = 'Index';
// 二级域名
// 三级域名
if (2 === $level) {
$subDomain = strval($hostParts[0]);
switch (strtolower($subDomain)) {
case 'www': // 主站
case 'new': // 原新版
case 'dev': // 开发环境
case 'm': // 老版(到频道选择)
case 'buy': // 测试环境的域名, 以后可去掉
case 'login': // 登录
break;
case 'new': // 原新版(到男生首页)
$controller = 'Boys';
break;
case 'search': // 搜索
$controller = 'Search';
... ... @@ -88,12 +89,12 @@ class Bootstrap extends Bootstrap_Abstract
$module = 'Guang';
break;
case 'list': // 商品列表
case 'item': // 商品详情
$module = 'Product';
break;
case 'sale'://促销
$module = 'Product';
$controller = 'sale';
case 'cart': // 购物车
$module = 'Cart';
break;
default: // 其它(识别为品牌)
$module = 'Product';
$action = 'Brand';
... ... @@ -104,6 +105,7 @@ class Bootstrap extends Bootstrap_Abstract
$dispatcher->getRequest()->module = $module;
$dispatcher->getRequest()->controller = $controller;
$dispatcher->getRequest()->action = $action;
/* 根据对应模块的配置,添加相应的路由规则 */
$iniFile = APPLICATION_PATH . '/configs/routes.' . strtolower($module) . '.ini';
if (file_exists($iniFile)) {
... ...
<?php
use Action\WebAction;
use Action\WebAction;
use Index\HomeModel;
use Plugin\Captcha;
/**
* 女首
*/
... ... @@ -18,4 +18,5 @@ class GirlsController extends WebAction
);
$this->_view->display('index', $data);
}
}
\ No newline at end of file
... ...
<?php
use Action\WebAction;
use Plugin\Captcha;
class ImagesController extends WebAction
{
/**
* 验证码-生成
*
* @return mixed 验证码图片
*/
public function indexAction()
{
$g = trim($this->get('g'));
$namespace = !empty($g) ? $g : 'passport_istration';
$imgCode = new Captcha();
$imgCode->setWidth(150)->setHeight(50)->setWordLen(4)->generate($namespace);
exit();
}
/**
* 验证码-检测
*
* @param string auth_code (验证码)
* @return string true|false
*/
public function verifyimgcodeAction ()
{
if (strtolower($this->get('auth_code')) !== strtolower(Captcha::getFromSession('passport_istration')))
{
die('false');
}
die('true');
}
<?php
use Action\WebAction;
use Plugin\Captcha;
class ImagesController extends WebAction
{
/**
* 验证码-生成
*
* @return mixed 验证码图片
*/
public function indexAction()
{
$g = trim($this->get('g'));
$namespace = !empty($g) ? $g : 'passport_istration';
$imgCode = new Captcha();
$imgCode->setWidth(150)->setHeight(50)->setWordLen(4)->generate($namespace);
exit();
}
/**
* 验证码-检测
*
* @param string auth_code (验证码)
* @return string true|false
*/
public function verifyimgcodeAction ()
{
if (strtolower($this->get('auth_code')) !== strtolower(Captcha::getFromSession('passport_istration')))
{
die('false');
}
die('true');
}
}
\ No newline at end of file
... ...
<?php
<?php
use Yaf\Application;
define('SITE_MAIN', 'http://web.dev.yohobuy.com'); // 网站主域名
... ...