當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Arr::forget方法代碼示例

本文整理匯總了PHP中Arr::forget方法的典型用法代碼示例。如果您正苦於以下問題:PHP Arr::forget方法的具體用法?PHP Arr::forget怎麽用?PHP Arr::forget使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Arr的用法示例。


在下文中一共展示了Arr::forget方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: handleMessage

 /**
  * Handles the message.
  *
  * @param Message $message 
  * @param array $params
  * @param Discord $discord 
  * @param Config $config 
  * @return void 
  */
 public static function handleMessage($message, $params, $discord, $config)
 {
     $loadedComms = count($discord->websocket->listeners(Event::MESSAGE_CREATE));
     $message->channel->sendMessage('-' . count($loadedComms) . ' COMMANDS BEFORE RELOAD -');
     $message->channel->sendMessage('Reloading all commands from disk...');
     $discord->websocket->removeAllListeners(Event::MESSAGE_CREATE);
     $commandResearch = glob('./src/Commands/*.php');
     $commandLoad = true;
     foreach ($commandResearch as $file) {
         include $file;
     }
     $currCommands = getCommands();
     foreach ($currCommands as $command => $data) {
         $discord->websocket->on(Event::MESSAGE_CREATE, function ($message, $discord, $new) use($command, $data) {
             $content = explode(' ', $message->content);
             $config = Config::getConfig($discord->configfile);
             if ($content[0] == $config['prefix'] . $command) {
                 Arr::forget($content, 0);
                 $user_perms = @$config['perms']['perms'][$message->author->id];
                 if (empty($user_perms)) {
                     $user_perms = $config['perms']['default'];
                 }
                 if ($user_perms >= $data['perms']) {
                     try {
                         $data['class']::handleMessage($message, $content, $discord, $config, $this);
                     } catch (\Exception $e) {
                         $message->reply("There was an error running the command. `{$e->getMessage()}`");
                     }
                 } else {
                     $message->reply('You do not have permission to do this!');
                     echo "[Auth] User {$message->author->username} blocked from running {$config['prefix']}{$command}, <@{$message->author->id}>\r\n";
                 }
             }
         });
     }
     $loadedComms = count($discord->websocket->listeners(Event::MESSAGE_CREATE));
     $message->channel->sendMessage('-' . count($loadedComms) . ' COMMANDS AFTER RELOAD -');
 }
開發者ID:comentarinformal,項目名稱:DiscordPHPBot,代碼行數:47,代碼來源:ReloadCommands.php

示例2: array_forget

 /**
  * Remove one or many array items from a given array using "dot" notation.
  *
  * @param  array  $array
  * @param  array|string  $keys
  * @return void
  */
 function array_forget(&$array, $keys)
 {
     return Arr::forget($array, $keys);
 }
開發者ID:runningjack,項目名稱:busticketAPI1,代碼行數:11,代碼來源:helpers.php

示例3: forget

 /**
  * Remove item form Collection.
  *
  * @param string $key
  */
 public function forget($key)
 {
     Arr::forget($this->items, $key);
 }
開發者ID:chchmlml,項目名稱:ceshi,代碼行數:9,代碼來源:Collection.php

示例4: forget

 public static function forget($key)
 {
     return Arr::forget($_SESSION, $key);
 }
開發者ID:ncaneldiee,項目名稱:sampadeh,代碼行數:4,代碼來源:Session.php

示例5: forget

 /**
  * Remove item form Bag
  *
  * @param string $key
  */
 public function forget($key)
 {
     Arr::forget($this->data, $key);
 }
開發者ID:c78702505,項目名稱:phalcon-phputils,代碼行數:9,代碼來源:ObjectArray.php


注:本文中的Arr::forget方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。