当前位置: 首页>>代码示例>>PHP>>正文


PHP Pw::strlen方法代码示例

本文整理汇总了PHP中Pw::strlen方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::strlen方法的具体用法?PHP Pw::strlen怎么用?PHP Pw::strlen使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Pw的用法示例。


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

示例1: setRandCode

 /**
  * 设置验证码
  * 
  * @return void
  */
 protected static function setRandCode()
 {
     switch (self::$verifyType) {
         case '1':
             $str = '1234567890';
             break;
         case '2':
             $str = 'abcdefghjkmnpqrstuvwxyABCDEFGHJKLMNPQRSTUVWXY';
             break;
         case '3':
         default:
             $str = '3456789bcefghjkmpqrtvwxyzBCEFGHJKMPQRTVWXYZ';
             break;
         case '5':
             $str = '人之初性本善性相近习相远苟不教性乃迁教之道贵以专昔孟母择邻处子不学断机杼窦燕山有义方教五子名俱扬养段算适讲按值美态黄易彪服早班麦削信排台声该击素张密害侯草何树肥继右属市严径螺检左页抗苏显苦英快称坏移约巴材省黑武培著河帝仅针怎植京助升王眼她抓含苗副杂普谈围食射源例致酸旧却充足短划剂宣环落首尺波承粉践府鱼随考刻靠够满夫失包住促枝局菌杆周护岩师举曲春元超负砂封换太模贫减阳扬江析亩木言球朝医校古呢稻宋听唯输滑站另卫字鼓刚写刘微略范供阿块某功套友限项余倒卷创律雨让骨远帮初皮播优占死毒圈伟季训控激找叫云互跟裂粮粒母练塞钢顶策双留误础吸阻故寸盾晚丝女散焊功株亲院冷彻弹错散商视艺灭版烈零室轻血倍缺厘泵察绝富城冲喷壤简否柱李望盘磁雄似困巩益洲脱投送奴侧润盖挥距触星松送获兴独官混纪依未突架宽冬章湿偏纹吃执阀矿寨责熟稳夺硬价努翻奇甲预职评读背协损棉侵灰虽矛厚罗泥辟告卵箱掌氧恩爱停曾溶营终纲孟钱待尽俄缩沙退陈讨奋械载胞幼哪剥迫旋征槽倒握担仍呀鲜吧卡粗介钻逐弱脚怕盐末阴丰编印蜂急拿扩伤飞露核缘游振操央伍域甚迅辉异序免纸夜乡久隶缸夹念兰映沟乙吗儒杀汽磷艰晶插埃燃欢铁补咱芽永瓦倾阵碳演威附牙芽永瓦斜灌欧献顺猪洋腐请透司危括脉宜笑若尾束壮暴企菜穗楚汉愈绿拖牛份染既秋遍锻玉夏疗尖殖井费州访吹荣铜沿替滚客召旱悟刺脑';
             break;
         case '4':
         case '6':
             self::$verifyCode = self::_convert(self::$askCode);
             return true;
         case '7':
             //目前只有这些声音文件
             $str = '123456789BCEFGHJKMPQRTVWXYZ';
             break;
     }
     $_tmp = Pw::strlen($str) - 1;
     $_num = 0;
     for ($i = 0; $i < self::$verifyLength; $i++) {
         $_num = mt_rand(0, $_tmp);
         $_code = Pw::substrs($str, 1, $_num, false);
         self::$verifyCode .= self::_convert($_code);
     }
 }
开发者ID:mm999,项目名称:EduSoho,代码行数:38,代码来源:PwBaseCode.php

示例2: _getMP3Audio

 private static function _getMP3Audio()
 {
     self::$_audioVerify = '';
     $_len = Pw::strlen(self::$verifyCode);
     for ($i = 0; $i < $_len; $i++) {
         $_code = strtoupper(self::$verifyCode[$i]);
         self::$_audioVerify .= WindFile::read(self::$_audioPath . '/' . $_code . '.mp3', WindFile::READ);
     }
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:9,代码来源:PwAudioCode.php

示例3: decorateSaveProperty

 public function decorateSaveProperty($property, $moduleid)
 {
     if (Pw::strlen($property['html']) > 10000) {
         return new PwError('DESIGN:html.length.error');
     }
     $property['html_tpl'] = $property['html'];
     $property['limit'] = 1;
     return $property;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:9,代码来源:PwDesignHtmlDataService.php

示例4: doAddAction

 /**
  * 发存修改一个发现数据 
  * 
  * @access public
  * @return void
  */
 public function doAddAction()
 {
     list($fid, $title, $href, $des, $vieworder) = $this->getInput(array('fid', 'title', 'href', 'des', 'vieworder'));
     $title = trim($title);
     $href = trim($href);
     $des = trim($des);
     $vieworder = (int) $vieworder;
     if (empty($title)) {
         $this->showError("NATIVE:fresh.title.empty");
     }
     if (empty($href)) {
         $this->showError("NATIVE:fresh.link.empty");
     }
     if (Pw::strlen($title) > 5) {
         $this->showError("名称不能超过5个字符");
     }
     if (Pw::strlen($des) > 9) {
         $this->showError("备注不能超过9个字符");
     }
     if ($fid) {
         $fname = $fid;
     } else {
         $maxId = $this->_getDao()->getMaxId();
         $fname = count($maxId) ? $maxId['fresh_id'] + 1 : 1;
     }
     if (!$fid && !$_FILES) {
         $this->showError('NATIVE:upload.empty');
     }
     if ($_FILES) {
         Wind::import('SRV:upload.action.PwFreshUpload');
         Wind::import('LIB:upload.PwUpload');
         $bhv = new PwFreshUpload();
         $bhv->filename = $fname;
         $upload = new PwUpload($bhv);
         if ($upload->check() === true) {
             $result = $upload->execute();
         }
         if ($result !== true) {
             $this->showError($result->getError());
         }
         if (!($data = $bhv->getAttachInfo())) {
             $this->showError('upload.fail');
         }
         $img = $data['path'] . $data['filename'];
     }
     $data = array('title' => $title, 'href' => $href, 'des' => $des, 'vieworder' => $order);
     if ($img && $_FILES) {
         $data['img'] = $img;
     }
     if ($fid) {
         $this->_getDao()->updateFresh($fid, $data);
     } else {
         $this->_getDao()->addFresh($data);
     }
     $this->showMessage('success');
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:62,代码来源:FreshController.php

示例5: editType

 /**
  * 修改分类名称
  *
  * @param int $id
  * @param string $name
  * @return bool|object
  */
 public function editType($id, $name)
 {
     if (empty($name)) {
         return new PwError('USER:attention.type.name.empty');
     }
     if (Pw::strlen($name) > 10) {
         return new PwError('USER:attention.type.name.length.over');
     }
     return $this->_getDao()->editType($id, array('name' => $name));
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:17,代码来源:PwAttentionType.php

示例6: dorunAction

 /**
  * 后台设置-email设置
  */
 public function dorunAction()
 {
     $password = $this->getInput('mailPassword', 'post');
     $config = $this->_getConfig();
     $t = Pw::strlen($config['mail.password']);
     $passwordO = Pw::substrs($config['mail.password'], 1, 0, false) . '********' . Pw::substrs($config['mail.password'], 1, $t - 1, false);
     $password = $password == $passwordO ? $config['mail.password'] : $password;
     $config = new PwConfigSet('email');
     $config->set('mailOpen', $this->getInput('mailOpen', 'post'))->set('mailMethod', 'smtp')->set('mail.host', $this->getInput('mailHost', 'post'))->set('mail.port', $this->getInput('mailPort', 'post'))->set('mail.from', $this->getInput('mailFrom', 'post'))->set('mail.auth', $this->getInput('mailAuth', 'post'))->set('mail.user', $this->getInput('mailUser', 'post'))->set('mail.password', $password)->flush();
     $this->showMessage('ADMIN:success');
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:14,代码来源:EmailController.php

示例7: getAnnounceForBbsScroll

 /**
  * 通过公告记录组装前台显示效果
  * 帖子列表滚动展示标题用
  *
  * @return array
  */
 public function getAnnounceForBbsScroll()
 {
     $announces = array();
     $announceInfos = $this->_getPwAnnounceDs()->getAnnounceByTimeOrderByVieworder(Pw::str2time(Pw::time2str(Pw::getTime(), 'Y-m-d')), 9, 0);
     foreach ($announceInfos as $value) {
         $announces[$value['aid']] = $value;
         $announces[$value['aid']]['start_date'] = Pw::time2str($value['start_date'], 'Y-m-d');
         if (Pw::strlen($value['subject']) > 18) {
             $announces[$value['aid']]['subject'] = Pw::substrs($value['subject'], 18);
         }
     }
     return $announces;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:19,代码来源:PwAnnounceService.php

示例8: forceDownload

 protected function forceDownload($string, $filename, $ext = 'txt')
 {
     $router = Wind::getComponent('router');
     $agent = $router->request->getServer('HTTP_USER_AGENT');
     if (preg_match("/MSIE/", $agent)) {
         $filename = urlencode($filename);
     }
     $filename .= '.' . $ext;
     ob_end_clean();
     header('Content-Encoding: none');
     header("Content-type: application/octet-stream");
     header('Content-type: text/html; charset=' . Wekit::app()->charset . '');
     header("Accept-Ranges: bytes");
     header("Accept-Length: " . Pw::strlen($string));
     header("Content-Disposition: attachment; filename=" . $filename);
     echo $string;
     @flush();
     @ob_flush();
     exit;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:20,代码来源:ExportController.php

示例9: _bulidContent

 protected function _bulidContent($array, &$errcode)
 {
     $errcode = array();
     $array['content'] = str_replace(array("\r", "\n", "\t"), '', $array['content']);
     $array['content'] = WindSecurity::escapeHTML($array['content']);
     if ($array['ifshield']) {
         $array['subject'] = '';
         $array['content'] = '<span style="text-decoration: line-through">此帖已被屏蔽</span>';
     } elseif ($array['useubb']) {
         $ubb = new PwUbbCodeConvertThread();
         $array['reminds'] && $ubb->setRemindUser($array['reminds']);
         $array['pic'] && $ubb->setAttachParser(new PwFreshAttachDisplay($array['pic']));
         $array['content'] = PwSimpleUbbCode::convert($array['content'], 140, $ubb);
         PwSimpleUbbCode::isSubstr() && ($errcode['is_read_all'] = true);
     } elseif (Pw::strlen($array['content']) > 140) {
         $errcode['is_read_all'] = true;
         $array['content'] = Pw::substrs($array['content'], 140);
     }
     return $array;
 }
开发者ID:YoursBoss,项目名称:nextwind,代码行数:20,代码来源:PwFreshDisplay.php

示例10: checkTagName

 public function checkTagName($tagName = '')
 {
     $tagName = $tagName ? $tagName : $this->_data['tag_name'];
     if (!$tagName) {
         return true;
     }
     $maxLength = 15;
     if (($result = $this->isNameHasIllegalChar($tagName)) !== false) {
         return $result;
     }
     if (Pw::strlen($tagName) > $maxLength) {
         return new PwError('TAG:tagname.length.error', array('{maxlength}' => $maxLength));
     }
     return true;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:15,代码来源:PwTagDm.php

示例11: _substrs

 protected static function _substrs($message, $length)
 {
     $strlen = Pw::strlen($message);
     if ($strlen > $length) {
         $message = Pw::substrs($message, $length);
         $strlen = $length;
         self::$_isSubstr = true;
     }
     return array($message, $strlen);
 }
开发者ID:latticet,项目名称:EduSoho_jb51,代码行数:10,代码来源:PwSimpleUbbCode.php

示例12: dorunAction

 /** 
  * 编辑用户信息
  */
 public function dorunAction()
 {
     $userDm = new PwUserInfoDm($this->loginUser->uid);
     $userDm->setRealname($this->getInput('realname', 'post'));
     $userDm->setByear($this->getInput('byear', 'post'));
     $userDm->setBmonth($this->getInput('bmonth', 'post'));
     $userDm->setBday($this->getInput('bday', 'post'));
     $userDm->setGender($this->getInput('gender', 'post'));
     $userDm->setHomepage($this->getInput('homepage', 'post'));
     $userDm->setProfile($this->getInput('profile', 'post'));
     list($hometown, $location) = $this->getInput(array('hometown', 'location'), 'post');
     /* @var $srv PwAreaService */
     $srv = Wekit::load('area.srv.PwAreaService');
     $areas = $srv->fetchAreaInfo(array($hometown, $location));
     $userDm->setHometown($hometown, isset($areas[$hometown]) ? $areas[$hometown] : '');
     $userDm->setLocation($location, isset($areas[$location]) ? $areas[$location] : '');
     //没有禁止签名的时候方可编辑签名
     if ($this->loginUser->getPermission('allow_sign')) {
         $bbsSign = $this->getInput('bbs_sign', 'post');
         if (($len = $this->loginUser->getPermission('sign_max_length')) && Pw::strlen($bbsSign) > $len) {
             //仅在此限制签名字数
             $this->showError(array('USER:user.edit.sign.length.over', array('{max}' => $len)));
         }
         Wind::import('LIB:ubb.PwUbbCode');
         Wind::import('LIB:ubb.config.PwUbbCodeConvertConfig');
         $ubb = new PwUbbCodeConvertConfig();
         $ubb->isConverImg = $this->loginUser->getPermission('sign_ubb_img') ? true : false;
         $userDm->setBbsSign($bbsSign)->setSignUseubb($bbsSign != PwUbbCode::convert($bbsSign, $ubb) ? 1 : 0);
     }
     $result = $this->_editUser($userDm, PwUser::FETCH_MAIN + PwUser::FETCH_INFO);
     if ($result instanceof PwError) {
         $this->showError($result->getError());
     } else {
         $this->loginUser->info = array_merge($this->loginUser->info, $userDm->getData());
         $this->showMessage('USER:user.edit.profile.success');
     }
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:40,代码来源:IndexController.php

示例13: getFileName

 protected function getFileName()
 {
     $num = 6;
     $filename = $this->thumbW . '_' . $this->thumbH . '_';
     $str = '0123456789abcdefghjkmnopqrstuvwxyABCDEFGHJKLMNOPQRSTUVWXY';
     $len = Pw::strlen($str) - 1;
     for ($i = 0; $i < $num; $i++) {
         $_num = mt_rand(0, $len);
         $filename .= substr($str, $_num, 1);
     }
     $filename .= '.' . $this->ext;
     return $filename;
 }
开发者ID:fanqimeng,项目名称:4tweb,代码行数:13,代码来源:PwDesignImage.php

示例14: addTag

 /**
  * 新增分类
  * Enter description here ...
  * @param int $logid
  * @param string $tagname
  */
 public function addTag($uid, $tagname)
 {
     if (Pw::strlen($tagname) < 2) {
         return new PwError('BBS:like.tagname.is.short');
     }
     if (Pw::strlen($tagname) > 10) {
         return new PwError('BBS:like.tagname.is.lenth');
     }
     $tagInfos = $this->_getLikeTagDs()->getInfoByUid($uid);
     foreach ($tagInfos as $info) {
         if ($tagname == $info['tagname']) {
             return new PwError('BBS:like.tagname.is.already');
         }
     }
     Wind::import('SRV:like.dm.PwLikeTagDm');
     $dm = new PwLikeTagDm();
     $dm->setTagname($tagname)->setUid($uid)->setNumber(0);
     return $this->_getLikeTagDs()->addInfo($dm);
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:25,代码来源:PwLikeService.php

示例15: _buildCode

 private function _buildCode($len = 4)
 {
     $str = '123456789';
     $_tmp = Pw::strlen($str) - 1;
     $code = '';
     $_num = 0;
     for ($i = 0; $i < $len; $i++) {
         $_num = mt_rand(0, $_tmp);
         $code .= $str[$_num];
     }
     return $code;
 }
开发者ID:chendong0444,项目名称:phpwind,代码行数:12,代码来源:PwMobileService.php


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