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

PHP Func类代码示例

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

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



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

示例1: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Buffer = new Func('Buffer', function () {
         $self = new Buffer();
         $self->init(func_get_args());
         return $self;
     });
     $Buffer->set('prototype', Buffer::$protoObject);
     $Buffer->setMethods(Buffer::$classMethods, true, false, true);
     return $Buffer;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:Buffer.php


示例2: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Error = new Func(function ($str = null) {
         $error = new self($str);
         $error->stack = debug_backtrace();
         return $error;
     });
     $Error->set('prototype', self::$protoObject);
     $Error->setMethods(self::$classMethods, true, false, true);
     return $Error;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:15,代码来源:Error.php


示例3: shouldWriteReturnType

 /**
  * @param Func $function
  * @param bool $hack
  *
  * @return bool
  */
 private function shouldWriteReturnType(Func $function, $hack)
 {
     $name = $function->getReflection()->getName();
     if ($function->getReflection() instanceof \ReflectionMethod && in_array($name, ['__construct', '__destruct', '__clone'])) {
         return false;
     }
     $comment = $function->getReturnComment();
     if (!$comment) {
         return false;
     }
     return $comment->getType() && $comment->getType()->getDeclaration($hack);
 }
开发者ID:dchesterton,项目名称:phpdoc-to-return,代码行数:18,代码来源:Converter.php


示例4: read

 /**
  * @param Func $function
  * @return SignatureData[]
  */
 public function read(Func $function)
 {
     $params = array();
     foreach ($function->reflection()->getParameters() as $param) {
         $data = new SignatureData();
         $data->name = $param->getName();
         $data->type = $this->getType($param);
         $data->default = $this->getDefault($param);
         $data->hasDefault = $param->isOptional();
         $params[] = $data;
     }
     return $params;
 }
开发者ID:rawebone,项目名称:injector,代码行数:17,代码来源:SignatureReader.php


示例5: update

 /** загрузка(сохранение/обновление) аватара
  * @param integer ID записи
  * @param boolean удалять предыдущий аватар
  * @return имя файла успешно загруженной аватары | false
  */
 function update($nRecordID, $bDeletePrevious = false, $bDoUpdateQuery = false)
 {
     global $oDb;
     if ($nRecordID && !empty($_FILES) && $_FILES[$this->input]['error'] == UPLOAD_ERR_OK) {
         $oUpload = new Upload($this->input, false);
         $aImageSize = getimagesize($_FILES[$this->input]['tmp_name']);
         if ($oUpload->isSuccessfull() && $aImageSize !== FALSE && in_array($aImageSize[2], array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG))) {
             if ($bDeletePrevious) {
                 $this->delete($nRecordID, false);
             }
             $sExtension = func::image_type_to_extension($aImageSize[2], false);
             $sFilename = Func::generateRandomName($this->filenameLetters, true, true) . '.' . $sExtension;
             //проверяем размер файла
             if (!$oUpload->checkSize($this->maxsize)) {
                 return false;
             }
             //создаем thumbnail
             $oThumb = new thumbnail($_FILES[$this->input]['tmp_name']);
             $oThumb->jpeg_quality(85);
             $oThumb->crop_proportionaly(1, 1, 'middle', 'center');
             $oThumb->createTumbnail_if_more_then($this->path . $nRecordID . '_' . $sFilename, $this->width, $this->height, true);
             @unlink($_FILES[$this->input]['tmp_name']);
             if ($bDoUpdateQuery) {
                 $oDb->execute("UPDATE {$this->table} \n                                   SET {$this->fieldAvatar} =" . $oDb->str2sql($sFilename) . "\n                                   WHERE {$this->fieldID} = {$nRecordID} ");
             }
             return $sFilename;
         }
     }
     return false;
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:35,代码来源:avatar.php


示例6: signUp

 public static function signUp(array $data)
 {
     if (!$data) {
         return false;
     }
     if (!isset($data['last_login_time'])) {
         $data['last_login_time'] = time();
     }
     if (!isset($data['last_login_ip'])) {
         $data['last_login_ip'] = Func::getIP();
     }
     if (!isset($data['login_time'])) {
         $data['login_time'] = time();
     }
     if (!isset($data['login_ip'])) {
         $data['login_ip'] = Func::getIP();
     }
     if (!isset($data['create_time'])) {
         $data['create_time'] = time();
     }
     $data['login_count'] = 1;
     $data['user_code'] = self::getNewUserCode();
     $insertid = 0;
     DB::tranBegin();
     $insertid = self::insert($data);
     DB::tranEnd();
     return $insertid;
 }
开发者ID:isonz,项目名称:fxptpcn,代码行数:28,代码来源:Users.class.php


示例7: basicAction

 /**
  * 合作机构基本信息
  */
 public function basicAction($uni_id)
 {
     //判断是否是ajax
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['union_logo'] = $validate->getPost('union_logo');
         //机构logo
         $data['union_name'] = $validate->getPost('union_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //机构名称
         //验证参数
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成机构logo,缩略图
         if ($data['union_logo']) {
             $data['union_logo'] = \Func::touchImg($data['union_logo'], 'union_logo');
             //监测图片是否生成成功
             if (!$data['union_logo']) {
                 \FileUtil::getInstance()->unlink(UPLOAD_PATH . $data['union_logo']);
                 $this->end(400);
             }
         }
         $this->end((new \Union())->updUnionBasic($this->session->get('id'), $uni_id, $data));
     }
     //机构id
     $uni_id = (int) $uni_id;
     //获取基本数据
     $basic = (new \Union())->getUnionBasic($uni_id);
     //加载js
     $this->assets->addJs('backend/mt-js/union.js');
     $this->view->setVars(['uni_id' => $uni_id, 'basic' => $basic]);
 }
开发者ID:xw716825,项目名称:git_back,代码行数:35,代码来源:UnionController.php


示例8: newAction

 /**
  * 新增属性
  */
 public function newAction()
 {
     //检查是否是ajax请求
     if ($this->request->isAjax()) {
         $validate = new \Validate();
         $data['att_img'] = $validate->getPost('att_img', \Validate::base64());
         //属性图
         $data['att_name'] = $validate->getPost('att_name', \Validate::regex('/^[a-z0-9\\x{4e00}-\\x{9fa5}]{2,30}$/iu'));
         //属性名称
         $data['att_sort'] = $validate->getPost('att_sort', \Validate::int());
         //排序
         //验证数据
         if ($validate->getMessage()) {
             $this->end(400);
         }
         //生成学校logo,缩略图
         $data['att_img'] = \Func::touchImg($data['att_img'], 'att_img');
         //将生成的图片地址存入img,用户失败时删除
         $img = [UPLOAD_PATH . $data['att_img'], UPLOAD_PATH . $data['att_img']];
         //监测图片是否全部生成成功
         if (!$data['att_img']) {
             \FileUtil::getInstance()->unlink($img);
         }
         //新增高校
         $result = (new \Attribute())->addAttribute($this->session->get('id'), $data);
         if ($result != 200) {
             \FileUtil::getInstance()->unlink($img);
         }
         $this->end($result);
     }
     //加载所需js
     $this->assets->addJs('backend/mt-js/attribute-new.js');
 }
开发者ID:xw716825,项目名称:git_back,代码行数:36,代码来源:AttributeController.php


示例9: init

 public function init()
 {
     Yii::app()->user->opt_id = time() . rand(10000, 99999);
     Yii::app()->user->logNotice = array();
     Func::validateURL();
     $this->request = Yii::app()->request;
 }
开发者ID:wheatma,项目名称:react_study,代码行数:7,代码来源:Controller.php


示例10: smarty_modifier_dateleft

/**
 * Smarty dateleft modifier plugin
 *
 * Type:     modifier<br>
 * Name:     dateleft<br>
 * Purpose:  dateleft
 * @author battazo
 * @param string
 * @param string
 * @param interger
 * @param interger
 * @param string                   
 * @param string
 */
function smarty_modifier_dateleft($sDatetime, $getTime = false)
{
    //get datetime
    if (!$sDatetime) {
        return false;
    }
    $date = Func::parse_datetime($sDatetime);
    //    function dateDiff($dformat, $endDate, $beginDate)
    //    {
    //        $date_parts1 = explode($dformat, $beginDate);
    //        $date_parts2 = explode($dformat, $endDate);
    //        $start_date  = gregoriantojd($date_parts1[0], $date_parts1[1], $date_parts1[2]);
    //        $end_date    = gregoriantojd($date_parts2[0], $date_parts2[1], $date_parts2[2]);
    //        return $end_date - $start_date;
    //    }
    //    $date1="07/11/2003";
    //    $date2="09/04/2004";
    //    print "If we minus " . $date1 . " from " . $date2 . " we get " . dateDiff("/", $date2, $date1) . ".";
    //    If we minus 07/11/2003 from 09/04/2004 we get 421.
    //$dob="08/12/1975";
    //echo "If you were born on " . $dob . ", then today your age is approximately " .
    //round(dateDiff("/", date("m/d/Y", time()), $dob)/365, 0) . " years.";
    //If you were born on 08/12/1975, then today your age is approximately 30 years.
    smarty_modifier_datespent($sDatetime, $getTime);
}
开发者ID:Sywooch,项目名称:dobox,代码行数:39,代码来源:modifier.dateleft.php


示例11: edit

 /**
  * @descrpition 修改
  */
 public function edit()
 {
     if (Request::getRequest('dosubmit', 'str')) {
         $jumpUrl = '/admin.php/itemdocmenu/edit/id-' . $this->param['id'];
         $fields = array();
         $fields['name'] = Request::getRequest('name', 'str');
         $fields['pid'] = Request::getRequest('pid', 'str');
         $fields['in_out'] = Request::getRequest('in_out', 'str');
         $fields['url'] = Request::getRequest('url', 'str');
         $fields['item'] = strtolower(Request::getRequest('item', 'item'));
         if (empty($fields['name']) || empty($fields['item'])) {
             View::showAdminErrorMessage($jumpUrl, '未填写完成');
         }
         $result = ItemDocMenuBusiness::editMenu($this->param['id'], $fields);
         if ($result) {
             View::showAdminMessage('/admin.php/itemdocmenu/lists', '修改成功');
         } else {
             View::showAdminErrorMessage($jumpUrl, '修改失败');
         }
     }
     $menuList = ItemDocMenuBusiness::getMenuList();
     $menuList = Func::arrayKey($menuList);
     $blogMenuList = Func::categoryTree($menuList);
     $blogMenu = ItemDocMenuBusiness::getMenu($this->param['id']);
     View::assign('blogMenu', $blogMenu);
     View::assign('blogMenuList', $blogMenuList);
     View::showAdminTpl('item_doc_menu_edit');
 }
开发者ID:web5,项目名称:LX_Blog,代码行数:31,代码来源:itemdocmenu.php


示例12: backup

 /**
  * 数据库备份
  */
 public function backup()
 {
     set_time_limit(0);
     $data = array();
     if ($_POST) {
         $backup_dir = BASEPATH . '../cache/backup/';
         if (!is_dir($backup_dir)) {
             mkdir($backup_dir, '0777', true);
         }
         include dirname(__FILE__) . '/../../config/config.db.php';
         $cfg = $db[$db['active_group']];
         $is_export_student = intval($this->input->post('is_export_student'));
         $sql_file = DbmanageModel::backupTables($cfg['database'], $backup_dir, array('*'), $is_export_student);
         if (file_exists($backup_dir . $sql_file)) {
             require_once APPPATH . 'libraries/Pclzip.php';
             $save_file = $backup_dir . "/zmte_database.zip";
             if (is_file($save_file)) {
                 @unlink($save_file);
             }
             $archive = new PclZip($save_file);
             //将文件进行压缩
             $archive->create($backup_dir . $sql_file, PCLZIP_OPT_REMOVE_ALL_PATH);
             @unlink($backup_dir . $sql_file);
             Func::dumpFile('application/zip', $save_file, 'zmte_database_' . date('YmdHis') . '.zip');
             @unlink($save_file);
             redirect('/admin/dbmanage/backup');
         } else {
             message('数据库备份失败,请稍后重试!');
         }
     } else {
         $this->load->view('dbmanage/backup', $data);
     }
 }
开发者ID:Vincent-Shen,项目名称:origin,代码行数:36,代码来源:dbmanage.php


示例13: addAction

 /**
  * 回答接口
  */
 public function addAction()
 {
     //取值,参数验证,签名验证
     $vars = ['mem_id', 'mem_mark', 'empty_ans_id', 'mem_relation_id', 'que_id', 'ans_content', 'is_img', 'sign'];
     $this->beforeGetVarExecVerify($vars, 'post');
     //判断是否是图片
     if ($this->data['is_img'] == 1) {
         $this->data['ans_content'] = \Func::touchImg($this->data['ans_content'], 'ans');
         if (!$this->data['ans_content']) {
             $this->throwMessage(ILLEGAL_IMAGE);
         }
     }
     //默认执行回答提问方法
     $func = 'addAnswer';
     //需要的字段
     $field = ['mem_id', 'mem_mark', 'mem_relation_id', 'que_id', 'ans_content'];
     //根据可空回答id,empty_ans_id判断是否执行追问方法
     if ($this->data['empty_ans_id']) {
         array_push($field, $this->data['empty_ans_id']);
         $func = 'addAnswerAsk';
     }
     //转义回答内容
     $this->data['ans_content'] = mb_substr(\Func::escape($this->data['ans_content']), 0, 250, 'utf-8');
     //获取执行状态,执行失败,并且是图片信息,则删除上传的图片
     $add_status = $this->callModelFunc('Answer', $func, $field);
     if ($add_status != OK && $this->data['is_img'] == 1) {
         \FileUtil::getInstance()->unlink(PUBLIC_PATH . $this->data['ans_content']);
     }
     $this->throwMessage($add_status);
 }
开发者ID:xw716825,项目名称:work,代码行数:33,代码来源:AnswerController.php


示例14: toTable

 /** @return Table */
 function toTable()
 {
     $zcoeffs = array();
     foreach ($this->function->getSet() as $var => $coeff) {
         $zcoeffs[$var] = $coeff->multiply(-1);
     }
     $z = new ValueFunc($zcoeffs, 0);
     $z2b = Fraction::create(0);
     $z2coeffs = array();
     foreach ($this->restrictions as $idx => $r) {
         foreach ($r->getSet() as $var => $coeff) {
             if (strncmp($var, 'y', 1) === 0 && $coeff->isEqualTo(1)) {
                 foreach ($r->getSet() as $v => $c) {
                     !isset($z2coeffs[$v]) && ($z2coeffs[$v] = Fraction::create(0));
                     strncmp($v, 'y', 1) !== 0 && ($z2coeffs[$v] = $z2coeffs[$v]->subtract($c));
                 }
                 $z2b = $z2b->subtract($r->getLimit());
             }
         }
     }
     $z2 = count($z2coeffs) ? new ValueFunc($z2coeffs, $z2b) : NULL;
     $table = new Table($z, $z2);
     foreach ($this->basismap as $var => $idx) {
         $table->addRow(new TableRow($var, $this->restrictions[$idx]->getSet(), $this->restrictions[$idx]->getLimit()));
     }
     return $table;
 }
开发者ID:uestla,项目名称:simplex-calculator,代码行数:28,代码来源:Task.php


示例15: init

 function init()
 {
     $errno = strip_tags(Func::GETPOST('errno'));
     if ($errno) {
         $this->set($errno);
         $this->sm->assign('errno', $errno);
     }
 }
开发者ID:Sywooch,项目名称:dobox,代码行数:8,代码来源:errors.php


示例16: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $String = new Func(function ($value = '') {
         $self = Func::getContext();
         if ($self instanceof Str) {
             $self->value = to_string($value);
             return $self;
         } else {
             return to_string($value);
         }
     });
     $String->instantiate = function () {
         return new Str();
     };
     $String->set('prototype', Str::$protoObject);
     $String->setMethods(Str::$classMethods, true, false, true);
     return $String;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:22,代码来源:String.php


示例17: getGlobalConstructor

 /**
  * Creates the global constructor used in user-land
  * @return Func
  */
 static function getGlobalConstructor()
 {
     $Boolean = new Func(function ($value = false) {
         $self = Func::getContext();
         if ($self instanceof Bln) {
             $self->value = $value ? true : false;
             return $self;
         } else {
             return $value ? true : false;
         }
     });
     $Boolean->instantiate = function () {
         return new Bln();
     };
     $Boolean->set('prototype', Bln::$protoObject);
     $Boolean->setMethods(Bln::$classMethods, true, false, true);
     return $Boolean;
 }
开发者ID:mk-pmb,项目名称:js2php,代码行数:22,代码来源:Boolean.php


示例18: call

 public static function call($kid, $queueName, $info, $mod = '', $action = 'run')
 {
     $queue = new CloudTaskQueue($queueName);
     $logtime = time();
     $params = base64_encode(json_encode($info));
     $key = Func::madeQueueKey($kid, $logtime, $params);
     $queue->addTask(QUEUE_URL, "mod={$mod}&action={$action}&kid={$kid}&logtime={$logtime}&params=" . urlencode($params) . "&key={$key}");
     $ret = $queue->push();
     return true;
 }
开发者ID:web5,项目名称:LX_Blog,代码行数:10,代码来源:httpqueue.common.php


示例19: __construct

 /**
  *
  * 构造函数
  * @param $param 实例化时传入的参数
  */
 public function __construct($param = array())
 {
     $this->param = $param;
     //分类菜单相关
     $this->adminMenuObi = new AdminMenuModel();
     $this->menuList = $this->adminMenuObi->getList();
     $this->menuList = Func::arrayKey($this->menuList);
     $this->menuListTree = Func::categoryTree($this->menuList);
     View::assign('menuList', $this->menuListTree);
 }
开发者ID:ishawge,项目名称:LX_Blog,代码行数:15,代码来源:admincontroller.class.php


示例20: smarty_modifier_date_format2

/**
 * Smarty date_format2 modifier plugin
 *
 * Type:     modifier<br>
 * Name:     date_format2<br>
 * Purpose:  date_format2
 * @author battazo
 * @param string
 * @param string
 * @param interger
 * @param interger
 * @param string
 * @param string
 */
function smarty_modifier_date_format2($sDatetime, $getTime = false, $bSkipYearIfCurrent = false, $glue1 = ' ', $glue2 = ' в ')
{
    if (!$sDatetime) {
        if (is_string($bSkipYearIfCurrent)) {
            return $bSkipYearIfCurrent;
        }
        return false;
    }
    $res = Func::parse_datetime($sDatetime);
    switch (intval($res['month'])) {
        case '1':
            $res['month'] = 'Января';
            break;
        case '2':
            $res['month'] = 'Февраля';
            break;
        case '3':
            $res['month'] = 'Марта';
            break;
        case '4':
            $res['month'] = 'Апреля';
            break;
        case '5':
            $res['month'] = 'Мая';
            break;
        case '6':
            $res['month'] = 'Июня';
            break;
        case '7':
            $res['month'] = 'Июля';
            break;
        case '8':
            $res['month'] = 'Августа';
            break;
        case '9':
            $res['month'] = 'Сентября';
            break;
        case '10':
            $res['month'] = 'Октября';
            break;
        case '11':
            $res['month'] = 'Ноября';
            break;
        case '12':
            $res['month'] = 'Декабря';
            break;
        default:
            break;
    }
    if ($getTime) {
        return intval($res['day']) . ' ' . $res['month'] . ($bSkipYearIfCurrent === true && date('Y', time()) == $res['year'] ? '' : $glue1 . $res['year']) . (!(int) $res['hour'] && !(int) $res['min'] ? '' : $glue2 . $res['hour'] . ':' . $res['min']);
    } else {
        return intval($res['day']) . ' ' . $res['month'] . ($bSkipYearIfCurrent === true && date('Y', time()) == $res['year'] ? '' : $glue1 . $res['year']);
    }
}
开发者ID:Sywooch,项目名称:dobox,代码行数:69,代码来源:modifier.date_format2.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP FunctionArgumentOperand类代码示例发布时间:2022-05-23
下一篇:
PHP Fuel类代码示例发布时间: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