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


PHP util類代碼示例

本文整理匯總了PHP中util的典型用法代碼示例。如果您正苦於以下問題:PHP util類的具體用法?PHP util怎麽用?PHP util使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: lista5

 public function lista5()
 {
     $codi = $_SESSION['codi'];
     $cnx = new util();
     $cn = $cnx->getConexion();
     $res = $cn->prepare("call detinvestiga(:codi)");
     $res->bindParam(":codi", $codi);
     $res->execute();
     foreach ($res as $row) {
         $lista5[] = $row;
     }
     return $lista5;
 }
開發者ID:GeekSof,項目名稱:ProjectWeb,代碼行數:13,代碼來源:dao.php

示例2: InserNos

 public function InserNos($cuer)
 {
     /*PARA INSERTAR LOS PRODUCTOS*/
     $cnx = new util();
     $cn = $cnx->getConexion();
     /*(:titu, :cuer)*/
     $res = $cn->prepare("call editaNos(:cuer)");
     /*AQUI ESTOY LLAMANDO AL PROCEDIMIENTO: INSERTAR PRODUCTOS, ENVIANDO DE PARAMETROS TITU Y CUER*/
     /*$res->bindParam(":titu", $tit);*/
     /*insertMis*/
     $res->bindParam(":cuer", $cuer);
     $res->execute();
 }
開發者ID:JMitac,項目名稱:WebService,代碼行數:13,代碼來源:nosotros.model.php

示例3: executeContact

 public function executeContact(sfWebRequest $request)
 {
     $this->checkUser();
     $vanity = $request->getParameter('username');
     $this->f = $request->getParameter('f');
     $c = new Criteria();
     $c->add(SfGuardUserProfilePeer::VANITY, $vanity, Criteria::EQUAL);
     $userProfile = SfGuardUserProfilePeer::doSelectOne($c);
     $this->forward404Unless($userProfile);
     $this->user = $userProfile->getsfGuardUser();
     $this->form = new UserContactForm();
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameter('contact'));
         if ($this->form->isValid()) {
             if ($this->user->getProfile()->getMailsContacto() == 1) {
                 $codigo = util::generateUID();
                 $this->user->getProfile()->setCodigo($codigo);
                 $this->user->getProfile()->save();
                 $mailBody = $this->getPartial('contactMailBody', array('destinatario' => $this->user->getProfile()->getNombre(), 'remitente' => $this->getUser()->getProfile()->getNombre(), 'cuerpo' => $this->form->getValue('mensaje'), 'vanity' => $this->getUser()->getProfile()->getVanity(), 'codigo' => $codigo));
                 try {
                     VoMail::sendWithRet("Tienes un mensaje de " . $this->getUser()->getProfile()->getNombre() . "", $mailBody, $this->user->getUsername(), array('no-reply@voota.es' => 'no-reply Voota'), $this->getUser()->getUsername(), true);
                     return "SendSuccess";
                 } catch (Exception $e) {
                     return "SendFail";
                 }
             } else {
                 return "SendFail";
             }
         }
         return "SendSuccess";
     }
 }
開發者ID:voota,項目名稱:voota,代碼行數:32,代碼來源:actions.class.php

示例4: __construct

 /**
  * Create new instance of handler.
  */
 public function __construct()
 {
     global $CFG;
     if (empty($CFG->session_memcached_save_path)) {
         $this->savepath = '';
     } else {
         $this->savepath = $CFG->session_memcached_save_path;
     }
     if (empty($this->savepath)) {
         $this->servers = array();
     } else {
         $this->servers = util::connection_string_to_memcache_servers($this->savepath);
     }
     if (empty($CFG->session_memcached_prefix)) {
         $this->prefix = ini_get('memcached.sess_prefix');
     } else {
         $this->prefix = $CFG->session_memcached_prefix;
     }
     if (!empty($CFG->session_memcached_acquire_lock_timeout)) {
         $this->acquiretimeout = (int) $CFG->session_memcached_acquire_lock_timeout;
     }
     if (!empty($CFG->session_memcached_lock_expire)) {
         $this->lockexpire = (int) $CFG->session_memcached_lock_expire;
     }
 }
開發者ID:janaece,項目名稱:globalclassroom4_clean,代碼行數:28,代碼來源:memcached.php

示例5: run

 public static function run()
 {
     if (!isset($_SERVER['REDIRECT_URL'])) {
         throw new Exception();
     }
     $_SERVER['REDIRECT_URL'] = substr($_SERVER['REDIRECT_URL'], strlen(config::prefix()));
     $path = explode('/', $_SERVER['REDIRECT_URL']);
     //array_shift($path);
     if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
         req::$controller = array_shift($path);
         if ($path && preg_match('/^[0-9a-z]+$/i', $path[0])) {
             req::$function = array_shift($path);
         }
     }
     unset($path);
     session::get_instance()->start();
     if (uuid::check(req::$controller)) {
         $obj = state::load(req::$controller);
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         call_user_func(array($obj, req::$function));
     } else {
         $obj = eval('return new ' . req::$controller . '_ctrl();');
         if (!$obj instanceof ctrl) {
             throw new Exception();
         }
         util::redirect($obj, req::$function, $_GET);
     }
 }
開發者ID:RuschGaming,項目名稱:twitch,代碼行數:30,代碼來源:engine.php

示例6: unzip

 protected function unzip($zip, $path)
 {
     // build the temporary folder path
     $tmp = $this->tmp(preg_replace('!.zip$!', '', $zip));
     // extract the zip file
     util::unzip($zip, $tmp);
     // get the list of directories within our tmp folder
     $dirs = glob($tmp . '/*');
     // get the source directory from the tmp folder
     if (isset($dirs[0]) && is_dir($dirs[0])) {
         $source = $dirs[0];
     } else {
         throw new RuntimeException('The source directory could not be found');
     }
     // create the folder if it does not exist yet
     if (!is_dir($path)) {
         mkdir($path);
     }
     // extract the content of the directory to the final path
     foreach ((array) array_diff(scandir($source), ['.', '..']) as $name) {
         if (!rename($source . '/' . $name, $path . '/' . $name)) {
             throw new RuntimeException($name . ' could not be copied');
         }
     }
     // remove the zip file
     util::remove($zip);
     // remove the temporary folder
     util::remove($tmp);
 }
開發者ID:getkirby,項目名稱:cli,代碼行數:29,代碼來源:Command.php

示例7: wpgrade_callback_change_icon_params

function wpgrade_callback_change_icon_params($params)
{
    //add new params in the right order
    $params = util::array_insert_after('size', $params, 'link', array('type' => 'text', 'name' => 'Link', 'options' => array(), 'admin_class' => 'span6'));
    $params = util::array_insert_after('link', $params, 'link_target_blank', array('type' => 'switch', 'name' => 'Open in new window', 'options' => array(), 'admin_class' => 'span5 push1'));
    return $params;
}
開發者ID:pwzCypher,項目名稱:wp-push,代碼行數:7,代碼來源:filter-shortcodes.php

示例8: _init_mysql

 public static function _init_mysql($config = array())
 {
     if (empty($config)) {
         // 記住不要把原來有的配置信息給強製換成$GLOBALS['config']['db'],否則換數據庫會有問題
         self::$config = empty(self::$config) ? $GLOBALS['config']['db'] : self::$config;
     } else {
         self::$config = $config;
     }
     if (!self::$conn) {
         self::$conn = @mysqli_connect(self::$config['host'], self::$config['user'], self::$config['pass'], self::$config['name'], self::$config['port']);
         if (mysqli_connect_errno()) {
             self::$conn_fail++;
             $errmsg = 'Mysql Connect failed[' . self::$conn_fail . ']: ' . mysqli_connect_error();
             echo util::colorize(date("H:i:s") . " {$errmsg}\n\n", 'fail');
             log::add($errmsg, "Error");
             // 連接失敗5次,中斷進程
             if (self::$conn_fail >= 5) {
                 exit(250);
             }
             self::_init_mysql($config);
         } else {
             // 連接成功清零
             self::$conn_fail = 0;
             self::$worker_pid = function_exists('posix_getpid') ? posix_getpid() : 0;
             mysqli_query(self::$conn, " SET character_set_connection=utf8, character_set_results=utf8, character_set_client=binary, sql_mode='' ");
         }
     } else {
         $curr_pid = function_exists('posix_getpid') ? posix_getpid() : 0;
         // 如果父進程已經生成資源就釋放重新生成,因為多進程不能共享連接資源
         if (self::$worker_pid != $curr_pid) {
             self::reset_connect();
         }
     }
 }
開發者ID:jackyxie,項目名稱:phpspider,代碼行數:34,代碼來源:db.php

示例9: execute

 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($this->isInstalled() === false) {
         throw new RuntimeException('There seems to be no valid Kirby installation in this folder!');
     }
     $output->writeln('<info>Updating Kirby...</info>');
     $output->writeln('');
     // check if the panel is installed at all
     $hasPanel = is_dir($this->dir() . '/panel');
     // start updating the core
     $output->writeln('Updating the core...');
     // remove the old folder
     util::remove($this->dir() . '/kirby');
     // update the core
     $this->install(['repo' => 'getkirby/kirby', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby', 'output' => $output]);
     // still has the old toolkit submodule
     if (is_dir($this->dir() . '/kirby/toolkit')) {
         // start updating the toolkit
         $output->writeln('Updating the toolkit...');
         // remove the toolkit folder first
         util::remove($this->dir() . '/kirby/toolkit');
         // update the toolkit
         $this->install(['repo' => 'getkirby/toolkit', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/kirby/toolkit', 'output' => $output]);
     }
     if ($hasPanel) {
         // start updating the panel
         $output->writeln('Updating the panel...');
         // remove the old panel folder first
         util::remove($this->dir() . '/panel');
         // update the panel
         $this->install(['repo' => 'getkirby/panel', 'branch' => $input->getOption('dev') ? 'develop' : 'master', 'path' => $this->dir() . '/panel', 'output' => $output]);
     }
     $output->writeln('<comment>Kirby has been updated to: ' . $this->version() . '!</comment>');
     $output->writeln('');
 }
開發者ID:getkirby,項目名稱:cli,代碼行數:35,代碼來源:Update.php

示例10: process

 public static function process()
 {
     $security = new Security();
     $security->verifyPre();
     $data = stream_get_contents(fopen('php://input', 'r'));
     $compressedSize = strlen($data);
     $security->verifyCompressedData($data, $compressedSize);
     $data = @gzdecode($data);
     $uncompressedSize = strlen($data);
     $security->validateData($data, $uncompressedSize);
     $json = json_decode($data, true);
     $security->validateJson($json);
     if (isset($json['icon'])) {
         $img = self::getServerIcon($json['icon']);
         $json['icon'] = $img;
         Log::info("Valid Image: {$img}");
         $data = json_encode($json);
         $uncompressedSize = strlen($data);
     } else {
     }
     $key = util::uuid(false);
     $cacheFile = Cache::getFile($key);
     Log::info("Uploaded {$uncompressedSize} bytes as {$key} to {$cacheFile}");
     Cache::put($key, $data);
     header("Location: " . BASE_URL_VIEW . "/?id={$key}");
     self::output("Compressed Size: {$compressedSize}\nUncompressed Size: {$uncompressedSize}\nRaw Upload: " . BASE_URL_VIEW . "/?id={$key}&raw=1");
 }
開發者ID:LinEvil,項目名稱:timings,代碼行數:27,代碼來源:Uploader.php

示例11: doSignIn

 public function doSignIn()
 {
     $prompt = null;
     $email = null;
     $password = null;
     if ($_POST) {
         $email = util::request("email", "P");
         $password = util::request("password", "P");
         if (empty($email)) {
             $prompt = "郵箱不能為空";
         } else {
             if (empty($password)) {
                 $prompt = "密碼不能為空";
             } else {
                 $isOk = true;
                 //$this->load("user")->checkUser();
                 if ($isOk) {
                     util::redirect("http://cgi.daotianhudong.com/?c=admin&a=index");
                 } else {
                     $prompt = "用戶名或密碼錯誤";
                 }
             }
         }
     }
     $template = resource::getView('admin');
     $template->assign("prompt", $prompt);
     $template->assign("email", $email);
     $template->assign("password", $password);
     $template->display('signin.tpl');
 }
開發者ID:ChangAiQing,項目名稱:framework_app,代碼行數:30,代碼來源:admin.php

示例12: __autoload

function __autoload($autoload)
{
    if (file_exists(util::base() . '/application/' . $autoload . '.php')) {
        include util::base() . '/application/' . $autoload . '.php';
    } elseif (file_exists(util::base() . '/system/' . $autoload . '.php')) {
        include util::base() . '/system/' . $autoload . '.php';
    }
}
開發者ID:RuschGaming,項目名稱:twitch,代碼行數:8,代碼來源:index.php

示例13: error_report_array

 public static function error_report_array($arr)
 {
     $fp = fopen('./' . errorHandler::uuid() . '.log', 'wb');
     $res = "";
     util::printArray($res, $arr);
     fwrite($fp, $res);
     fclose($fp);
 }
開發者ID:skydel,項目名稱:universal-online-exam,代碼行數:8,代碼來源:errorHandler.php

示例14: nav1

 public function nav1() : string
 {
     error_log(__METHOD__);
     $a = util::nav($this->g->nav1);
     array_shift($a);
     return '
   <nav>' . $this->nav($a);
 }
開發者ID:netserva,項目名稱:www,代碼行數:8,代碼來源:view.php

示例15: printArray

 public static function printArray(&$res, $array)
 {
     foreach ($array as $key => $value) {
         $res .= "{$key} => {$value}";
         if (is_array($value)) {
             util::printArray($res, $value);
         }
     }
 }
開發者ID:skydel,項目名稱:universal-online-exam,代碼行數:9,代碼來源:util.php


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