dggzichahu/application/index/controller/Index.php

48 lines
1.3 KiB
PHP
Executable File

<?php
// +----------------------------------------------------------------------
// | 宏驰云科技开发团队 版权所有 拥有最终解释权
// +----------------------------------------------------------------------
// | Author: HcyShop-kiki
// +----------------------------------------------------------------------
namespace app\index\controller;
use app\common\server\ConfigServer;
use think\Controller;
class Index extends Controller
{
public function index()
{
$template = app()->getRootPath() . 'public/pc/index.html';
if (is_mobile()) {
$template = app()->getRootPath() . 'public/mobile/index.html';
}
if (file_exists($template)) {
return view($template);
}
return '';
}
public function app()
{
if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strpos($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
$url = ConfigServer::get('app', 'line_ios', '');
} else {
$url = ConfigServer::get('app', 'line_android', '');
}
if (empty($url)) {
echo '未设置app下载链接';
exit;
}
if (!preg_match("/^http(s)?:\\/\\/.+/", $url)) {
$url = "http://".$url;
}
$this->redirect($url);
}
}