• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP app\App类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中app\App的典型用法代码示例。如果您正苦于以下问题:PHP App类的具体用法?PHP App怎么用?PHP App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了App类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $access_token = generate_access_token();
     $email = 'a1t1-' . generate_email() . '@telegramlogin.com';
     $user = new User();
     $user->name = 'david pichsenmeister';
     $user->username = 'pichsenmeister';
     $user->email = $email;
     $user->telegram_id = 41478911;
     $user->access_token = $access_token;
     $user->save();
     $app = new App();
     $app->user_id = $user->id;
     $app->name = 'Telegram Login';
     $app->client_id = 314159265;
     $app->client_secret = generate_client_secret();
     $app->website = env('URL');
     $app->redirect_url = env('URL') . '/login';
     $app->save();
     $tg = new TelegramUser();
     $tg->telegram_id = 41478911;
     $tg->name = 'david pichsenmeister';
     $tg->username = 'pichsenmeister';
     $tg->save();
     $auth = new Auth();
     $auth->app_id = $app->id;
     $auth->telegram_user_id = $tg->id;
     $auth->email = $email;
     $auth->access_token = $access_token;
     $auth->save();
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:36,代码来源:UserTableSeeder.php


示例2: __construct

 /**
  * Method to instantiate the view.
  *
  * @param   App             $app             The application object.
  * @param   ModelInterface  $model           The model object.
  * @param   string|array    $templatesPaths  The templates paths.
  *
  * @throws  \RuntimeException
  * @since   1.0
  */
 public function __construct(App $app, ModelInterface $model, $templatesPaths = '')
 {
     parent::__construct($model);
     $this->app = $app;
     $renderer = $app->getContainer()->get('config')->get('renderer.type');
     $className = 'App\\View\\Renderer\\' . ucfirst($renderer);
     if (false == class_exists($className)) {
         throw new \RuntimeException(sprintf('Invalid renderer: %s', $renderer));
     }
     $config = array();
     $config['templates_base_dir'] = JPATH_TEMPLATES;
     // Load the renderer.
     $this->renderer = new $className($config);
     // Register application's Twig extension.
     $this->renderer->addExtension(new TwigExtension($app));
     // Register additional paths.
     if (!empty($templatesPaths)) {
         $this->renderer->setTemplatesPaths($templatesPaths, true);
     }
     // Register the theme path
     $this->renderer->set('themePath', DEFAULT_THEME . '/');
     // Retrieve and clear the message queue
     $this->renderer->set('flashBag', $app->getMessageQueue());
     $app->clearMessageQueue();
 }
开发者ID:KBO-Techo-Dev,项目名称:MagazinePro-jfw,代码行数:35,代码来源:DefaultHtmlView.php


示例3: getGenres

 /**
  * Récupère les genres d'un album
  */
 public function getGenres()
 {
     if (isset($this->id)) {
         $this->genres = App::getInstance()->getTable('Genres')->allByAlbum($this->id);
         $this->total_genres = count($this->genres);
     }
 }
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:10,代码来源:AlbumsEntity.php


示例4: getUser

 private function getUser($code, $state)
 {
     $app = App::findByClientId(314159265);
     $params = array('code' => $code, 'client_id' => $app->client_id, 'client_secret' => $app->client_secret);
     $ch = curl_init();
     curl_setopt($ch, CURLOPT_URL, env('URL') . '/code');
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
     $json = curl_exec($ch);
     $result = json_decode($json, true);
     if (!array_key_exists('access_token', $result)) {
         app()->abort($result['error'], $result['description']);
     }
     if (array_key_exists('active', $result) && !$result['active']) {
         app()->abort($result['error'], $result['description']);
     }
     $tg = TelegramUser::findByTelegramId($result['telegram_user']['telegram_id']);
     if ($tg->status != $state) {
         app()->abort(403, 'Invalid state.');
     }
     $tg->status = 'access_granted';
     $tg->save();
     try {
         $user = User::findByTelegramId($result['telegram_user']['telegram_id']);
     } catch (ModelNotFoundException $e) {
         $user = new User();
         $user->email = $result['email'];
         $user->telegram_id = $result['telegram_user']['telegram_id'];
     }
     $user->access_token = $result['access_token'];
     $user->name = $result['telegram_user']['name'];
     $user->username = $result['telegram_user']['username'];
     $user->save();
     return $user;
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:35,代码来源:UserController.php


示例5: actionDelete

 public function actionDelete()
 {
     if (!isset($_POST['imageId'])) {
         App::instance()->show404();
         exit;
     }
     /** @var \models\Image $model */
     $model = Image::findByID((int) $_POST['imageId']);
     if (!$model || $model->uid != App::instance()->getUser()->getId()) {
         App::instance()->show404();
         exit;
     }
     if ($model->delete()) {
         $response['error'] = false;
     } else {
         $response = json_encode(['error' => true]);
     }
     if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && 'XMLHttpRequest' === $_SERVER['HTTP_X_REQUESTED_WITH']) {
         $response['totalCount'] = Image::countByProp('uid', App::instance()->getUser()->getId());
         echo json_encode($response);
     } else {
         $this->redirect('/site/index/');
         echo $response;
     }
 }
开发者ID:VlPetukhov,项目名称:summa.local,代码行数:25,代码来源:SiteController.php


示例6: __construct

 public function __construct(array $attributes = [])
 {
     parent::__construct($attributes);
     $this->errors = new MessageBag();
     $this->validator = \App::make('validator');
     $this->manejaConcurrencia = true;
 }
开发者ID:kentronvzla,项目名称:webkentron,代码行数:7,代码来源:BaseModel.php


示例7: login

 /**
  * login process
  */
 public static function login()
 {
     // form validation
     if (!filter_input(INPUT_POST, "form_token") || Form::isFormTokenValid(filter_input(INPUT_POST, "form_token"))) {
         View::setMessageFlash("danger", "Form tidak valid");
         return FALSE;
     }
     if (!filter_input(INPUT_POST, "username") || !filter_input(INPUT_POST, "password")) {
         View::setMessageFlash("danger", "Masukkan Username dan Password");
         return FALSE;
     }
     $username = filter_input(INPUT_POST, "username", FILTER_SANITIZE_STRING);
     $password = md5(filter_input(INPUT_POST, "password", FILTER_SANITIZE_STRING));
     $mysqli = App::getConnection(true);
     $sql = "SELECT user_id FROM users WHERE username='{$username}' AND password='{$password}'";
     if (!($query = $mysqli->query($sql))) {
         View::setMessageFlash("danger", $mysqli->error);
         return FALSE;
     }
     if ($query->num_rows == 0) {
         View::setMessageFlash("danger", "Username dan Password Salah");
         return FALSE;
     }
     $row = $query->fetch_row();
     $_SESSION['user_id'] = $row[0];
     return TRUE;
 }
开发者ID:bahrul221,项目名称:tc-tgm,代码行数:30,代码来源:LoginController.php


示例8: translation

 public function translation($language = null)
 {
     if ($language == null) {
         $language = App::getLocale();
     }
     return $this->hasMany('App\\CategoryTranslation')->where('language_id', '=', $language);
 }
开发者ID:TEACHER-KEAK,项目名称:GAD,代码行数:7,代码来源:Category.php


示例9: config

 private static function config()
 {
     if (!static::$Config) {
         static::$Config = App::config('db');
     }
     return static::$Config;
 }
开发者ID:Akujin,项目名称:divergence,代码行数:7,代码来源:MySQL.php


示例10: actionLogout

 public function actionLogout()
 {
     if (!App::instance()->isGuest()) {
         App::instance()->logoutUser();
     }
     $this->redirect('/site/index/');
 }
开发者ID:VlPetukhov,项目名称:summa.local,代码行数:7,代码来源:UserController.php


示例11: getAlbums

 /**
  * Récupère les albums d'un artiste
  */
 public function getAlbums()
 {
     if (isset($this->id)) {
         $this->albums = App::getInstance()->getTable('Albums')->allByArtist($this->id);
         $this->total_albums = count($this->albums);
     }
 }
开发者ID:kMeillet,项目名称:mp3-player-api-js,代码行数:10,代码来源:ArtistsEntity.php


示例12: getLastWithCategories

 public static function getLastWithCategories()
 {
     return App::getDatabase()->query('
         SELECT article.id, article.titre, article.contenu, categories.titre as categorie
         FROM article
         LEFT JOIN categories
           ON categories.id = article.category_id', __CLASS__);
 }
开发者ID:NK-WEB-Git,项目名称:cosmosphp,代码行数:8,代码来源:Article.php


示例13: instance

 /**
  * Returns the singleton instance of this class.
  *
  * @return DatabaseService
  */
 public static function instance()
 {
     if (!isset(self::$instance)) {
         $db = App::instance()->config['db'];
         self::$instance = new \PDO('mysql:host=' . $db['host'] . ';dbname=' . $db['name'], $db['username'], $db['password'], $db['options']);
     }
     return self::$instance;
 }
开发者ID:nikolayh,项目名称:simple-php-api,代码行数:13,代码来源:DatabaseService.php


示例14: appView

 public function appView($app_id)
 {
     $appInfo = App::dataHandle(App::find($app_id));
     if (!$appInfo) {
         header('Location:' . action('App\\Http\\Controllers\\HomeController@index'));
     }
     $commendApps = App::dataHandle(App::where('category_id', '=', $appInfo->category_id)->where('id', '!=', $app_id)->orderBy('download', 'desc')->take(4)->get());
     return view('index.appView')->with(['appInfo' => $appInfo, 'commendApps' => $commendApps]);
 }
开发者ID:kevinwan,项目名称:che123,代码行数:9,代码来源:IndexController.php


示例15: __construct

 public function __construct($id)
 {
     $mysqli = App::getConnection(true);
     $sql = "SELECT * FROM " . $this->table . " WHERE " . $this->key . " = '" . $id . "'";
     if (!($query = $mysqli->query($sql))) {
         return;
     }
     $this->data = $query->fetch_assoc();
 }
开发者ID:bahrul221,项目名称:tc-tgm,代码行数:9,代码来源:Model.php


示例16: authorize

 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize()
 {
     if ($this->route('app')) {
         $id = $this->route('app');
         $user = $this->user();
         return App::where('id', '=', $id)->where('user_id', '=', $user->id)->exists();
     }
     return $this->user() ? true : false;
 }
开发者ID:3x14159265,项目名称:telegramlogin,代码行数:14,代码来源:AppRequest.php


示例17: __construct

 public function __construct()
 {
     parent::__construct();
     $app = App::getInstance();
     $auth = new DBAuth($app->getDb());
     if (!$auth->logged()) {
         $this->forbidden();
     }
 }
开发者ID:LoRayZm,项目名称:portfolio2,代码行数:9,代码来源:AppController.php


示例18: scopeGetPage

 public function scopeGetPage($query, $slug)
 {
     $query = $query->where('slug', '=', $slug)->firstOrFail();
     if (!$query) {
         App::abort(404);
     } else {
         return $query;
     }
 }
开发者ID:NotPrometey,项目名称:kvetky.loc,代码行数:9,代码来源:Page.php


示例19: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $cid = ['社交·娱乐' => 1, '射击·竞速' => 2, '冒险·益智' => 3, '场景·体验' => 4, '其他' => 5];
     /*        //3个平台
             $platforms = [
             	'android', 'ios', 'oculus'
             ];
             foreach ($platforms as $platform) {
             	for($i =1; $i<=5; $i++){
             		for($j=1; $j<=20; $j++){
             			App::create([
             				'ids' => uniqid(),
             				'name_chn' => '星际战争',
             				'name_eng' => 'Insectizide Wars VR',
             				'description' => '《星际战争》是一款ios虚拟现实格斗射击游戏。一个巨大的不明飞行物接近太阳系,并且飞快的像地球靠近,地球为了避免比撞击到,所以做出了相应的对策,当发现这个不明飞行并不是自然现象的时候,地球人类派出了宇宙飞船,进行保卫地球计划。喜欢星际题材的玩家快快下载体验吧!',
             				'platform' => $platform,
             				'operation' => 'head',
             				'cid' => $i,
             			]);
             		}
             	}
             }*/
     //1
     $file = file_get_contents('http://101.69.251.189:2183/android.json');
     $c = json_decode($file, true);
     foreach ($c as $v) {
         //$type = str_replace('.', '', $v['type']);
         if ($v['name'] == $v['nameE']) {
             $v['name'] = '';
         }
         App::create(['ids' => $v['id'], 'name_chn' => $v['name'], 'name_eng' => $v['nameE'], 'thumb' => $v['img'], 'description' => $v['info'], 'platform' => 'android', 'operation' => 'head', 'source' => $v['src'], 'cid' => isset($cid[$v['type']]) ? $cid[$v['type']] : 5]);
     }
     //2
     $file = file_get_contents('http://101.69.251.189:2183/ios.json');
     $c = json_decode($file, true);
     foreach ($c as $v) {
         //$type = str_replace('.', '', $v['type']);
         if ($v['name'] == $v['nameE']) {
             $v['name'] = '';
         }
         if (isset($v['src'])) {
             App::create(['ids' => $v['id'], 'name_chn' => $v['name'], 'name_eng' => $v['nameE'], 'thumb' => $v['img'], 'description' => $v['info'], 'platform' => 'ios', 'operation' => 'head', 'source' => $v['src'], 'cid' => isset($cid[$v['type']]) ? $cid[$v['type']] : 5]);
         }
     }
     //3
     $file = file_get_contents('http://101.69.251.189:2183/oculus.json');
     $c = json_decode($file, true);
     foreach ($c as $v) {
         //$type = str_replace('.', '', $v['type']);
         if ($v['name'] == $v['nameE']) {
             $v['name'] = '';
         }
         App::create(['ids' => $v['id'], 'name_chn' => $v['name'], 'name_eng' => $v['nameE'], 'thumb' => $v['img'], 'description' => $v['info'], 'platform' => 'oculus', 'operation' => 'head', 'source' => $v['src'], 'cid' => isset($cid[$v['type']]) ? $cid[$v['type']] : 5]);
     }
 }
开发者ID:yanguanglan,项目名称:appstore,代码行数:60,代码来源:AppTableSeeder.php


示例20: getTplPath

 /**
  * 获取模板绝对路径
  *
  * @param string $tpl
  * @return string
  */
 protected function getTplPath($tpl)
 {
     $slash = strpos($tpl, ':');
     if ($slash !== false) {
         $tpl = $slash === 0 ? substr($tpl, 1) : str_replace(':', '/', $tpl);
     } else {
         $controller = App::getController();
         $tpl = strtolower($controller) . '/' . $tpl;
     }
     return $tpl;
 }
开发者ID:qazzhoubin,项目名称:emptyphp,代码行数:17,代码来源:Controller.php



注:本文中的app\App类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP app\Article类代码示例发布时间:2022-05-23
下一篇:
PHP app\Address类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap