当前位置: 首页>>代码示例>>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;未经允许,请勿转载。