當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。