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

PHP strrchr函数代码示例

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

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



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

示例1: attach

 function attach($message,$name,$ctype = '') {

	 // type de contenu non defini
	 if(empty($ctype)){
		 // on essaie de reconnaitre l'extension
		 switch(strrchr(basename($name), ".")){
			 case ".gz": $ctype = "application/x-gzip"; break;
			 case ".tgz": $ctype = "application/x-gzip"; break;
			 case ".zip": $ctype = "application/zip"; break;
			 case ".pdf": $ctype = "application/pdf"; break;
			 case ".png": $ctype = "image/png"; break;
			 case ".gif": $ctype = "image/gif"; break;
			 case ".jpg": $ctype = "image/jpeg"; break;
			 case ".txt": $ctype = "text/plain"; break;
			 case ".htm": $ctype = "text/html"; break;
			 case ".html": $ctype = "text/html"; break;
			 default: $ctype = "application/octet-stream"; break;
	 	}
	}

	 $this->parts[] =
	 array (
	 "ctype" => $ctype,
	 "message" => $message,
	 "encode" => "",
	 "name" => $name
 	  );

 // fin de fonction
 }
开发者ID:rakotobe,项目名称:Rakotobe,代码行数:30,代码来源:CMail.php


示例2: add

 /**
  * Add a file
  * @param string
  * @param string
  * @param string
  */
 public function add($strFile, $strVersion = null, $strMedia = 'screen')
 {
     $strType = strrchr($strFile, '.');
     // Check the file type
     if ($strType != self::CSS && $strType != self::JS) {
         throw new Exception("Invalid file {$strFile}");
     }
     // Set the operation mode
     if (!$this->strMode) {
         $this->strMode = $strType;
     } elseif ($this->strMode != $strType) {
         throw new Exception('You cannot mix different file types. Create another Combiner object instead.');
     }
     // Prevent duplicates
     if (isset($this->arrFiles[$strFile])) {
         return;
     }
     // Check the source file
     if (!file_exists(TL_ROOT . '/' . $strFile)) {
         $this->import('StyleSheets');
         $this->StyleSheets->updateStyleSheets();
         // Retry
         if (!file_exists(TL_ROOT . '/' . $strFile)) {
             throw new Exception("File {$strFile} does not exist");
         }
     }
     // Default version
     if ($strVersion === null) {
         $strVersion = VERSION . '.' . BUILD;
     }
     // Store the file
     $arrFile = array('name' => $strFile, 'version' => $strVersion, 'media' => $strMedia);
     $this->arrFiles[$strFile] = $arrFile;
     $this->strKey .= '-f' . $strFile . '-v' . $strVersion . '-m' . $strMedia;
 }
开发者ID:jens-wetzel,项目名称:use2,代码行数:41,代码来源:Combiner.php


示例3: format

 public function format($source)
 {
     $this->tkns = token_get_all($source);
     $this->code = '';
     while (list($index, $token) = each($this->tkns)) {
         list($id, $text) = $this->getToken($token);
         $this->ptr = $index;
         switch ($id) {
             case T_TRAIT:
             case T_CLASS:
                 if ($this->leftUsefulTokenIs(T_DOUBLE_COLON)) {
                     $this->appendCode($text);
                     break;
                 }
                 $this->appendCode($text);
                 $this->printUntil(ST_CURLY_OPEN);
                 list(, $text) = $this->printAndStopAt(T_WHITESPACE);
                 if ($this->hasLn($text)) {
                     $text = substr(strrchr($text, 10), 0);
                 }
                 $this->appendCode($text);
                 break;
             default:
                 $this->appendCode($text);
                 break;
         }
     }
     return $this->code;
 }
开发者ID:studiokiwik,项目名称:php.tools,代码行数:29,代码来源:StripNewlineAfterClassOpen.php


示例4: save

 public static function save($path, UploadedFile $file)
 {
     $ext = substr(strrchr($file->getClientOriginalName(), '.'), 1);
     $new_name = md5(time() . rand()) . '.' . $ext;
     $file->move($path, $new_name);
     return $new_name;
 }
开发者ID:AchrafSoltani,项目名称:SymfonyCoreBundle,代码行数:7,代码来源:Upload.php


示例5: saveFile

 public function saveFile($data)
 {
     $post = (object) $data;
     self::setMapping();
     // recupera variáveis
     $fileData = $_FILES["filedata"];
     $fileName = $fileData["name"];
     $fileType = $fileData["type"];
     $tempName = $fileData["tmp_name"];
     $dataType = self::$mapping[$fileType];
     if (!is_uploaded_file($tempName)) {
         self::$response->success = false;
         self::$response->text = "O arquivo não foi enviado com sucesso. Erro de sistema: {$fileData['error']}.";
         return json_encode(self::$response);
     }
     if (!array_key_exists($fileType, self::$mapping)) {
         return '{"success":false,"records":0,"error":2,"root":[],"text":"Tipo de arquivo não mapeado para esta operação!"}';
     }
     // comprime arquivo temporário
     if ($dataType === true) {
         self::sizeFile();
         self::workSize($tempName);
     }
     $tempData = base64_encode(file_get_contents($tempName));
     // recupera extensão do arquivo
     $fileExtension = strtoupper(strrchr($fileName, "."));
     $fileExtension = str_replace(".", "", $fileExtension);
     $fileInfo = array("fileType" => $fileType, "fileExtension" => $fileExtension, "dataType" => $dataType, "fileName" => $fileName);
     $fileInfo = stripslashes(json_encode($fileInfo));
     $affectedRows = $this->exec("update {$post->tableName} set filedata = '{$tempData}', fileinfo = '{$fileInfo}' where id = {$post->id}");
     unlink($tempName);
     return $affectedRows;
 }
开发者ID:edilsonspalma,项目名称:AppAnest,代码行数:33,代码来源:TfileSerialize.php


示例6: carbon_preprocess_page

/**
* Implements hook_preprocess_page().
*/

function carbon_preprocess_page(&$variables) {
  $is_front = $variables['is_front'];
  // Adjust the html element that wraps the site name. h1 on front page, p on other pages
  $variables['wrapper_site_name_prefix'] = ($is_front ? '<h1' : '<p');
  $variables['wrapper_site_name_prefix'] .= ' id="site-name"';
  $variables['wrapper_site_name_prefix'] .= ' class="site-name'.($is_front ? ' site-name-front' : '').'"';
  $variables['wrapper_site_name_prefix'] .= '>';
  $variables['wrapper_site_name_suffix'] = ($is_front ? '</h1>' : '</p>');
  // If the theme's info file contains the custom theme setting
  // default_logo_path, set the $logo variable to that path.
  $default_logo_path = theme_get_setting('default_logo_path');
  if (!empty($default_logo_path) && theme_get_setting('default_logo')) {
    $variables['logo'] = file_create_url(path_to_theme() . '/' . $default_logo_path);
  }
  else {
    $variables['logo'] = null;
  }
  
  //Arrange the elements of the main content area (content and sidebars) based on the layout class
  $layoutClass = _carbon_get_layout();
  $layout = substr(strrchr($layoutClass, '-'), 1); //Get the last bit of the layout class, the 'abc' string
  
  $contentPos = strpos($layout, 'c');
  $sidebarsLeft = substr($layout,0,$contentPos);
  $sidebarsRight = strrev(substr($layout,($contentPos+1))); // Reverse the string so that the floats are correct.
  
  $sidebarsHidden = ''; // Create a string of sidebars that are hidden to render and then display:none
  if(stripos($layout, 'a') === false) { $sidebarsHidden .= 'a'; }
  if(stripos($layout, 'b') === false) { $sidebarsHidden .= 'b'; }
  
  $variables['sidebars']['left'] = str_split($sidebarsLeft);
  $variables['sidebars']['right'] = str_split($sidebarsRight);
  $variables['sidebars']['hidden'] = str_split($sidebarsHidden);
}
开发者ID:rtdean93,项目名称:tbytam,代码行数:38,代码来源:template.php


示例7: _getParentContentData

 private function _getParentContentData()
 {
     $data = $this->getData();
     $ids = array();
     while ($data && !$data->inherits) {
         $ids[] = strrchr($data->componentId, '-');
         $data = $data->parent;
     }
     while ($data) {
         if ($data->inherits) {
             $d = $data;
             foreach (array_reverse($ids) as $id) {
                 $d = $d->getChildComponent($id);
             }
             if (!$d) {
                 break;
             }
             if ($d->componentClass != $this->getData()->componentClass) {
                 return $d;
             }
         }
         $data = $data->parent;
     }
     return null;
 }
开发者ID:koala-framework,项目名称:koala-framework,代码行数:25,代码来源:Component.php


示例8: wpui_slide_shortcode

function wpui_slide_shortcode($atts, $content = null)
{
    extract(shortcode_atts(array('image' => false, 'image_title' => false), $atts));
    if ($image_title) {
        $imagea = wpui_get_media_item($image_title);
    }
    $image = $imagea['image'];
    if (!$image || !function_exists('getimagesize')) {
        return false;
    }
    if (is_array($imagea)) {
        $img_title = $imagea['title'];
    } else {
        $filename = substr(strrchr($image, '/'), 1);
        $filename = str_ireplace(strrchr($filename, '.'), '', $filename);
        $img_title = $filename;
    }
    $samp = getimagesize($image);
    if (!is_array($samp)) {
        return "Not a valid image.";
    }
    $output = '';
    $output .= '<h3 class="wp-tab-title">' . $imagea['title'] . '</h3>';
    $output .= '<div class="wpui-slide wp-tab-content">';
    $output .= '<img src="' . $image . '" />';
    $output .= '<div class="wpui_image_description">' . $content . '</div>';
    $output .= '</div><!-- end .wpui-slide -->';
    return $output;
}
开发者ID:Blueprint-Marketing,项目名称:interoccupy.net,代码行数:29,代码来源:wpui-slides.php


示例9: getName

 /**
  * 名称
  * @return string
  */
 function getName()
 {
     if (is_null($this->name)) {
         $this->name = strrchr(get_class($this), '\\');
     }
     return $this->name;
 }
开发者ID:slince,项目名称:application,代码行数:11,代码来源:Bridge.php


示例10: output_html

 /**
  * Modify the output of the field on the fronted profile.
  *
  * @since 1.2.0
  * @param  string $value the value of the field.
  * @param  object $field field details.
  * @return string        the formatted field value.
  */
 public static function output_html($value, $field)
 {
     $files = $value;
     $output = '';
     // Display files if they're images.
     if (wpaam_is_multi_array($files)) {
         foreach ($files as $key => $file) {
             $extension = !empty($extension) ? $extension : substr(strrchr($file['url'], '.'), 1);
             if (3 !== strlen($extension) || in_array($extension, array('jpg', 'gif', 'png', 'jpeg', 'jpe'))) {
                 $output .= '<span class="wpaam-uploaded-file-preview"><img src="' . esc_url($file['url']) . '" /></span>';
             } else {
                 $output .= '	<span class="wpaam-uploaded-file-name"><code>' . esc_html(basename($file['url'])) . '</code></span>';
             }
         }
         // We have a single file.
     } else {
         $extension = !empty($extension) ? $extension : substr(strrchr($files['url'], '.'), 1);
         if (3 !== strlen($extension) || in_array($extension, array('jpg', 'gif', 'png', 'jpeg', 'jpe'))) {
             $output .= '<span class="wpaam-uploaded-file-preview"><img src="' . esc_url($files['url']) . '" /></span>';
         } else {
             $output .= '	<span class="wpaam-uploaded-file-name"><code>' . esc_html(basename($files['url'])) . '</code></span>';
         }
     }
     return $output;
 }
开发者ID:devd123,项目名称:wpaam,代码行数:33,代码来源:file.php


示例11: save_images

function save_images($image_url, $post_id, $i)
{
    //set_time_limit(180); //每个图片最长允许下载时间,秒
    $file = file_get_contents($image_url);
    $fileext = substr(strrchr($image_url, '.'), 1);
    $fileext = strtolower($fileext);
    if ($fileext == "" || strlen($fileext) > 4) {
        $fileext = "jpg";
    }
    $savefiletype = array('jpg', 'gif', 'png', 'bmp');
    if (!in_array($fileext, $savefiletype)) {
        $fileext = "jpg";
    }
    $im_name = date('YmdHis', time()) . $i . mt_rand(10, 20) . '.' . $fileext;
    $res = wp_upload_bits($im_name, '', $file);
    if (isset($res['file'])) {
        $attach_id = insert_attachment($res['file'], $post_id);
    } else {
        return;
    }
    if (ot_get_option('auto_save_image_thumb') == 'on' && $i == 1) {
        set_post_thumbnail($post_id, $attach_id);
    }
    return $res;
}
开发者ID:xiapistudio,项目名称:tinection-fixed,代码行数:25,代码来源:auto-save-image.php


示例12: set_fromhost

 function set_fromhost()
 {
     global $proxyIPs;
     global $fullfromhost;
     global $fromhost;
     @($fullfromhost = $_SERVER["HTTP_X_FORWARDED_FOR"]);
     if ($fullfromhost == "") {
         @($fullfromhost = $_SERVER["REMOTE_ADDR"]);
         $fromhost = $fullfromhost;
     } else {
         $ips = explode(",", $fullfromhost);
         $c = count($ips);
         if ($c > 1) {
             $fromhost = trim($ips[$c - 1]);
             if (isset($proxyIPs) && in_array($fromhost, $proxyIPs)) {
                 $fromhost = $ips[$c - 2];
             }
         } else {
             $fromhost = $fullfromhost;
         }
     }
     if ($fromhost == "") {
         $fromhost = "127.0.0.1";
         $fullfromhost = "127.0.0.1";
     }
     if (defined("IPV6_LEGACY_IPV4_DISPLAY")) {
         if (strchr($fromhost, '.') && ($p = strrchr($fromhost, ':'))) {
             $fromhost = substr($p, 1);
         }
     }
     //sometimes,fromhost has strang space
     bbs_setfromhost(trim($fromhost), trim($fullfromhost));
 }
开发者ID:bianle,项目名称:www2,代码行数:33,代码来源:funcs.php


示例13: onMove

 public function onMove($typeProgress, $module, $name, $copy = FALSE)
 {
     $imgs = $this->getConfig('img');
     foreach ($imgs as $img) {
         $oldPath = $img['name'];
         $imagePath = substr(strstr($oldPath, '/files/'), 7);
         $newPath = $module . '/files/' . $imagePath;
         if ($oldPath !== $newPath) {
             if (stream_resolve_include_path($newPath) !== FALSE) {
                 /* check if an image with this path already exists in profile */
                 $fileInfo = pathinfo($imagePath);
                 $extension = strtolower($fileInfo['extension']);
                 $filename = $fileInfo['filename'];
                 /* allow to not overload filename with name_0_3_2_0 ... */
                 $generatedPart = strrchr($filename, '_');
                 if ($generatedPart !== FALSE && is_numeric(substr($generatedPart, 1))) {
                     $filename = substr($fileInfo['filename'], 0, -strlen($generatedPart));
                 }
                 $nbn = 0;
                 while (stream_resolve_include_path($newPath)) {
                     $imagePath = $filename . '_' . $nbn . '.' . $extension;
                     $newPath = $module . '/files/' . $imagePath;
                     $nbn++;
                 }
             }
             $this->setConfig('imgPath', $newPath);
             \tools::file_put_contents(PROFILE_PATH . $newPath, file_get_contents($oldPath, FILE_USE_INCLUDE_PATH));
         }
     }
 }
开发者ID:saitinet,项目名称:parsimony,代码行数:30,代码来源:block.php


示例14: importImages

 /**
  * import images
  *
  * @access public
  * @param $product, $image, $sku
  * @return void
  * 
  */
 private function importImages($product, $image, $sku)
 {
     $image_url = $image['img'];
     $image_url = str_replace("https://", "http://", $image_url);
     $image_type = substr(strrchr($image_url, "."), 1);
     $split = explode("?", $image_type);
     $image_type = $split[0];
     $imgName = basename($image_url);
     $imgName = str_replace('.' . $image_type, "", $imgName);
     $filename = md5($imgName . $sku) . '.' . $image_type;
     $dirPath = Mage::getBaseDir('media') . DS . 'import';
     if (!file_exists($dirPath)) {
         mkdir($dirPath, 0777, true);
     }
     $filepath = $dirPath . DS . $filename;
     $curl_handle = curl_init();
     curl_setopt($curl_handle, CURLOPT_URL, $image_url);
     curl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 2);
     curl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, 1);
     curl_setopt($curl_handle, CURLOPT_USERAGENT, 'Cirkel');
     $query = curl_exec($curl_handle);
     curl_close($curl_handle);
     file_put_contents($filepath, $query);
     if (file_exists($filepath)) {
         $attrIMG = array();
         if (array_key_exists('main', $image)) {
             if ($image['main'] == true) {
                 $attrIMG = array('image', 'thumbnail', 'small_image');
             }
         }
         $productMG = Mage::getModel('catalog/product')->loadByAttribute('sku', $product->getSku());
         $productMG->addImageToMediaGallery($filepath, $attrIMG, false, false);
         $productMG->save();
     }
 }
开发者ID:novapc,项目名称:magento,代码行数:43,代码来源:Productgenerator.php


示例15: convert

 /**
  * Convert the token
  *
  * @param Zend_Markup_Token $token
  * @param string $text
  *
  * @return string
  */
 public function convert(Zend_Markup_Token $token, $text)
 {
     $uri = $text;
     if (!preg_match('/^([a-z][a-z+\\-.]*):/i', $uri)) {
         $uri = 'http://' . $uri;
     }
     // check if the URL is valid
     if (!Zend_Markup_Renderer_Html::isValidUri($uri)) {
         return $text;
     }
     if ($token->hasAttribute('alt')) {
         $alt = $token->getAttribute('alt');
     } else {
         // try to get the alternative from the URL
         $alt = rtrim($text, '/');
         $alt = strrchr($alt, '/');
         if (false !== strpos($alt, '.')) {
             $alt = substr($alt, 1, strpos($alt, '.') - 1);
         }
     }
     // run the URI and alt through htmlentities
     $uri = htmlentities($uri, ENT_QUOTES, Zend_Markup_Renderer_Html::getEncoding());
     $alt = htmlentities($alt, ENT_QUOTES, Zend_Markup_Renderer_Html::getEncoding());
     return "<img src=\"{$uri}\" alt=\"{$alt}\"" . Zend_Markup_Renderer_Html::renderAttributes($token) . " />";
 }
开发者ID:be-dmitry,项目名称:zf1,代码行数:33,代码来源:Img.php


示例16: validaEmail

 /**
  * valida email
  * @param string $email
  */
 public function validaEmail($email)
 {
     $mail_correcto = 0;
     //verifico umas coisas
     if (strlen($email) >= 6 && substr_count($email, "@") == 1 && substr($email, 0, 1) != "@" && substr($email, strlen($email) - 1, 1) != "@") {
         if (!strstr($email, "'") && !strstr($email, "\"") && !strstr($email, "\\") && !strstr($email, "\$") && !strstr($email, " ")) {
             //vejo se tem caracter .
             if (substr_count($email, ".") >= 1) {
                 //obtenho a terminação do dominio
                 $term_dom = substr(strrchr($email, '.'), 1);
                 //verifico que a terminação do dominio seja correcta
                 if (strlen($term_dom) > 1 && strlen($term_dom) < 5 && !strstr($term_dom, "@")) {
                     //verifico que o de antes do dominio seja correcto
                     $antes_dom = substr($email, 0, strlen($email) - strlen($term_dom) - 1);
                     $caracter_ult = substr($antes_dom, strlen($antes_dom) - 1, 1);
                     if ($caracter_ult != "@" && $caracter_ult != ".") {
                         $mail_correcto = 1;
                     }
                 }
             }
         }
     }
     if ($mail_correcto) {
         return $email;
     } else {
         return false;
     }
 }
开发者ID:tricardo,项目名称:CartorioPostal_old,代码行数:32,代码来源:ValidacaoCLASS.php


示例17: upload_originales

function upload_originales($fichier, $destination, $ext)
{
    $sortie = array();
    // récupération du nom d'origine
    $nom_origine = $fichier['name'];
    // récupération de l'extension du fichier mise en minuscule et sans le .
    $extension_origine = substr(strtolower(strrchr($nom_origine, '.')), 1);
    // si l'extension ne se trouve pas (!) dans le tableau contenant les extensions autorisées
    if (!in_array($extension_origine, $ext)) {
        // envoi d'une erreur et arrêt de la fonction
        return "Erreur : Extension non autorisée";
    }
    // si l'extension est valide mais de type jpeg
    if ($extension_origine === "jpeg") {
        $extension_origine = "jpg";
    }
    // création du nom final  (appel de la fonction chaine_hasard, pour la chaine de caractère aléatoire)
    $nom_final = chaine_hasard(25);
    // on a besoin du nom final dans le tableau $sortie si la fonction réussit
    $sortie['poids'] = filesize($fichier['tmp_name']);
    $sortie['largeur'] = getimagesize($fichier['tmp_name'])[0];
    $sortie['hauteur'] = getimagesize($fichier['tmp_name'])[1];
    $sortie['nom'] = $nom_final;
    $sortie['extension'] = $extension_origine;
    // on déplace l'image du dossier temporaire vers le dossier 'originales'  avec le nom de fichier complet
    if (@move_uploaded_file($fichier['tmp_name'], $destination . $nom_final . "." . $extension_origine)) {
        return $sortie;
        // si erreur
    } else {
        return "Erreur lors de l'upload d'image";
    }
}
开发者ID:romualdbaldy,项目名称:romualdtestjuin,代码行数:32,代码来源:fonctions.php


示例18: parseValue

 public function parseValue($value)
 {
     preg_match_all('/%([^$]+)\\$/', $this->format_string, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
     $i = count($matches[1]);
     $values = [];
     foreach (array_reverse($matches[1]) as $match) {
         $fragmentType = strtolower(ltrim(strrchr(get_class($this->fragment), '\\'), '\\'));
         // era or unit
         $fragmentName = $this->fragment->internal_name;
         $partBegin = stripos($match[0], '{');
         if ($partBegin >= 0) {
             $partEnd = stripos($match[0], '}', $partBegin);
             $fragmentPart = trim(substr($match[0], $partBegin, $partEnd), '{}');
         } else {
             $fragmentPart = 'unknown';
         }
         $type = "{$fragmentType}.{$fragmentName}.{$fragmentPart}";
         if (with($txtObj = $this->texts()->where('fragment_text', $value))->count() > 0) {
             $value = $txtObj->first()->fragment_value;
         }
         $invert = preg_replace('/##(\\d+|\\{[^}]+\\})/', '*${1}+{epoch}%%${1}', str_replace(['\\*', '-%', '\\', '+', '-', ':', '/', '*', ':', '%%', '%', '__', '$$'], ['__', '$$', '##', ':', '+', '-', ':', '/', '*', '+{epoch}\\*', '+{epoch}-%', '+{epoch}%%', '+{epoch}%'], $match[0]));
         $output = BC::parse($invert, ['epoch' => $this->fragment->getEpochValue(), $fragmentPart => $value], 0);
         $values[$i] = [$type, $output];
         $i--;
     }
     return $values;
 }
开发者ID:danhunsaker,项目名称:calends,代码行数:27,代码来源:FragmentFormat.php


示例19: cdn_img_url

 /**
  * CDN图片域名
  *
  * @param string $img  图片地址
  * @param string $path 附加路径
  * @return string 完整URL图片地址
  */
 function cdn_img_url($img, $path = '/')
 {
     if (empty($img) || strpos($img, '://') !== false) {
         return $img;
     }
     if ($img[0] == '/') {
         $path = '';
     }
     /**
      * 当使用本机时,就不用CDN处理了
      */
     if (isset($_GET['local'])) {
         return "{$path}{$img}";
     }
     if (USE_ISLOCAL_JS2CSS || USE_ISLOCAL_IMG) {
         $file_ext = strtolower(strrchr($img, '.'));
         if (USE_ISLOCAL_JS2CSS && ($file_ext == '.js' || $file_ext == '.css')) {
             return "{$path}{$img}";
         }
         if (USE_ISLOCAL_IMG && ($file_ext == '.jpg' || $file_ext == '.jpeg' || $file_ext == '.gif' || $file_ext == '.swf' || $file_ext == '.png')) {
             return "{$path}{$img}";
         }
     }
     /**
      * 分服务器加载
      */
     static $img_hosts = null;
     static $img_count = null;
     if (is_null($img_hosts)) {
         $img_hosts = json_decode(IMG_URLS, true);
         $img_count = count($img_hosts);
     }
     $key = abs(crc32($img)) % $img_count;
     return "{$img_hosts[$key]}{$path}{$img}";
 }
开发者ID:laiello,项目名称:hecart,代码行数:42,代码来源:registry.php


示例20: read

 /**
  * Reads and returns a chunk of data.
  * @param int $len Number of bytes to read.  Default is to read configured buffer size number of bytes.
  * @return mixed buffer or -1 if EOF.
  */
 function read($len = null)
 {
     // if $len is specified, we'll use that; otherwise, use the configured buffer size.
     if ($len === null) {
         $len = $this->bufferSize;
     }
     if (($data = $this->in->read($len)) !== -1) {
         // not all files end with a newline character, so we also need to check EOF
         if (!$this->in->eof()) {
             $notValidPart = strrchr($data, "\n");
             $notValidPartSize = strlen($notValidPart);
             if ($notValidPartSize > 1) {
                 // Block doesn't finish on a EOL
                 // Find the last EOL and forget all following stuff
                 $dataSize = strlen($data);
                 $validSize = $dataSize - $notValidPartSize + 1;
                 $data = substr($data, 0, $validSize);
                 // Rewind to the begining of the forgotten stuff.
                 $this->in->skip(-$notValidPartSize + 1);
             }
         }
         // if !EOF
     }
     return $data;
 }
开发者ID:alexhandzhiev,项目名称:sifact,代码行数:30,代码来源:BufferedReader.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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