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


PHP strchr函数代码示例

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


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

示例1: get_md5

 private function get_md5()
 {
     // getting the md5 hash of the file
     $a[0] = $this->html->getElementByTagName("div.window_section")->nextsibling()->childNodes(1)->childNodes(0)->plaintext;
     $a[1] = $this->html->getElementByTagName("div.window_section")->nextsibling()->nextsibling()->childNodes(1)->childNodes(0)->plaintext;
     $this->md = trim(substr(strchr($a[0], "MD5:") ? $a[0] : $a[1], 4));
 }
开发者ID:vkisku,项目名称:apk_download,代码行数:7,代码来源:apk.php

示例2: isRotation

 /**
  * @TODO ! BAM
  *
  * @param $s1
  * @param $s2
  *
  * @return bool|int
  */
 public static function isRotation($s1, $s2)
 {
     if (!strchr($s2 . $s2, $s1)) {
         return false;
     }
     return true;
 }
开发者ID:sowbiba,项目名称:hackathon-dev-copy,代码行数:15,代码来源:RotationString.php

示例3: updateUser

 public function updateUser($id)
 {
     $req = $this->app->request();
     $imageName = $_FILES['image']['name'];
     $imageTmp = $_FILES['image']['tmp_name'];
     $uniqueID = md5(uniqid(rand(), true));
     $fileType = strchr($imageName, '.');
     $newUpload = 'assets/img_public/' . $uniqueID . $fileType;
     if ($imageName != null) {
         unlink(User::showImageUser($id));
     }
     move_uploaded_file($imageTmp, $newUpload);
     @chmod($newUpload, 0777);
     if ($imageName != null) {
         $sql = 'UPDATE users SET u_email = :u_email, u_password = :u_password, u_image = :u_image, level = :level WHERE user_id = :id';
     } else {
         $sql = 'UPDATE users SET u_email = :u_email, u_password = :u_password, level = :level WHERE user_id = :id';
     }
     $this->users = parent::connect()->prepare($sql);
     $this->users->bindValue(':u_email', $req->post('email'));
     $this->users->bindValue(':u_password', Bcrypt::hash($req->post('password')));
     if ($imageName != null) {
         $this->users->bindValue(':u_image', $newUpload);
     }
     $this->users->bindValue(':level', $req->post('level'));
     $this->users->bindValue(':id', $id);
     try {
         $this->users->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
开发者ID:Rotron,项目名称:ecommerce,代码行数:32,代码来源:User.php

示例4: get

 public function get($handle, $id)
 {
     $result = array();
     $lyric = '';
     // id should be url of lyric
     if (strchr($id, $this->sitePrefix) === FALSE) {
         return FALSE;
     }
     $content = FujirouCommon::getContent($id);
     if (!$content) {
         return FALSE;
     }
     $prefix = "<div class='lyricbox'>";
     $suffix = "<!--";
     $lyricLine = FujirouCommon::getSubString($content, $prefix, $suffix);
     $pattern = '/<\\/script>(.*)<!--/';
     $matchedString = FujirouCommon::getFirstMatch($lyricLine, $pattern);
     if (!$matchedString) {
         return FALSE;
     }
     $lyric = trim(str_replace('<br />', "\n", $matchedString));
     $lyric = FujirouCommon::decodeHTML($lyric);
     $lyric = trim(strip_tags($lyric));
     $handle->addLyrics($lyric, $id);
     return TRUE;
 }
开发者ID:Tstassin,项目名称:synology-scrobbler,代码行数:26,代码来源:lyric.php

示例5: thumbnail2

 public function thumbnail2(Request $request)
 {
     if ($request->hasFile('thumbnail_file2')) {
         $messages = ['photo.image' => '上传文件必须是图片', 'photo.max' => '上传文件不能大于:maxkb'];
         $this->validate($request, ['photo' => 'image|max:100000'], $messages);
         if ($request->file('thumbnail_file2')->isValid()) {
             $OriginalName = $request->file('thumbnail_file2')->getClientOriginalName();
             $file_pre = sha1(time() . $OriginalName);
             //取得当前时间戳
             $file_suffix = substr(strchr($request->file('thumbnail_file2')->getMimeType(), "/"), 1);
             //取得文件后缀
             $destinationPath = 'uploads';
             //上传路径
             $fileName = $file_pre . '.' . $file_suffix;
             //上传文件名
             Image::make($request->file('thumbnail_file2'))->resize(300, null, function ($constraint) {
                 $constraint->aspectRatio();
             })->save('uploads/thumbnails/' . $fileName);
             $request->file('thumbnail_file2')->move($destinationPath, $fileName);
             $img = new Img();
             $img->name = $fileName;
             $img->save();
             Session()->flash('img2', $fileName);
             return $fileName;
         } else {
             return "上传文件无效!";
         }
     } else {
         return "文件上传失败!";
     }
 }
开发者ID:goyuquan,项目名称:album,代码行数:31,代码来源:AdminController.php

示例6: SOAP_Test

 function SOAP_Test($methodname, $params, $expect = NULL, $cmp_func = NULL)
 {
     # XXX we have to do this to make php-soap happy with NULL params
     if (!$params) {
         $params = array();
     }
     if (strchr($methodname, '(')) {
         preg_match('/(.*)\\((.*)\\)/', $methodname, $matches);
         $this->test_name = $methodname;
         $this->method_name = $matches[1];
     } else {
         $this->test_name = $this->method_name = $methodname;
     }
     $this->method_params = $params;
     if ($expect !== NULL) {
         $this->expect = $expect;
     }
     if ($cmp_func !== NULL) {
         $this->cmp_func = $cmp_func;
     }
     // determine test type
     if ($params) {
         $v = array_values($params);
         if (gettype($v[0]) == 'object' && (get_class($v[0]) == 'SoapVar' || get_class($v[0]) == 'SoapParam')) {
             $this->type = 'soapval';
         }
     }
 }
开发者ID:garybulin,项目名称:php7,代码行数:28,代码来源:client_round2_params.php

示例7: putCSV

 /**
  * @param $handle
  * @param $fields
  * @param string $delimiter
  * @param string $enclosure
  * @param bool $useArrayKey
  * @param string $escape
  */
 public static function putCSV($handle, $fields, $delimiter = ',', $enclosure = '"', $useArrayKey = false, $escape = '\\')
 {
     $first = 1;
     foreach ($fields as $key => $field) {
         if ($first == 0) {
             fwrite($handle, $delimiter);
         }
         if ($useArrayKey) {
             $f = str_replace($enclosure, $enclosure . $enclosure, $key);
         } else {
             $field = EXPORT_ENCODE_FUNCTION != "none" && function_exists(EXPORT_ENCODE_FUNCTION) ? call_user_func(EXPORT_ENCODE_FUNCTION, $field) : $field;
             $f = str_replace($enclosure, $enclosure . $enclosure, $field);
         }
         if ($enclosure != $escape) {
             $f = str_replace($escape . $enclosure, $escape, $f);
         }
         if (strpbrk($f, " \t\n\r" . $delimiter . $enclosure . $escape) || strchr($f, "")) {
             fwrite($handle, $enclosure . $f . $enclosure);
         } else {
             fwrite($handle, $f);
         }
         $first = 0;
     }
     fwrite($handle, "\n");
 }
开发者ID:arnon22,项目名称:transportcm,代码行数:33,代码来源:FileManager.php

示例8: stripallslashes

 function stripallslashes($string)
 {
     while (strchr($string, '\\')) {
         $string = stripslashes($string);
     }
     return $string;
 }
开发者ID:Otti0815,项目名称:picosafe_webgui,代码行数:7,代码来源:class.secure.php

示例9: index

 public function index($doc_id = NULL)
 {
     $docss[0] = array("Basic Instructions" => 'basics.html');
     $docss[1] = array("Answering Queries" => 'queries.html');
     $docss[2] = array('Add Assignment' => "add_assignment.html", "Sample Assignment" => "sample_assignment.html", "Detect similar codes" => "moss.html", "Tests Structure" => "tests_structure.html", "Assignment Helper" => "assignment_helper.html");
     $docss[3] = array('About The Campus Judge' => 'readme.html', 'Users' => "users.html", 'Clean urls' => "clean_urls.html", 'Installation' => "installation.html", 'Settings' => "settings.html", 'Sandboxing' => "sandboxing.html", 'Security' => "security.html", 'Shield' => "shield.html");
     $baseaddr = "assets/docs/html/";
     //$filename="index.html";
     $level = $this->user->level;
     $docs = [];
     for ($i = 0; $i <= $level; $i++) {
         $docs = array_merge($docs, $docss[$i]);
     }
     if ($doc_id === NULL) {
         $data = array('all_assignments' => $this->assignment_model->all_assignments(), 'docs' => array_keys($docs));
         $this->twig->display('pages/docslist.twig', $data);
     } else {
         if (strchr($doc_id, ".md")) {
             $doc_id = array_search(str_replace(".md", ".html", $doc_id), $docs);
         }
         if ($doc_id && array_key_exists($doc_id, $docs)) {
             $data = array('all_assignments' => $this->assignment_model->all_assignments(), 'page' => file_get_contents($baseaddr . $docs[$doc_id]));
             //echo file_get_contents($baseaddr.$filename);
             $this->twig->display('pages/docview.twig', $data);
         } else {
             show_404();
         }
     }
 }
开发者ID:shubham1559,项目名称:The-Campus-Judge,代码行数:29,代码来源:Docs.php

示例10: image_thumb_onfly

function image_thumb_onfly($image_path, $height, $width, $crop = FALSE, $ratio = TRUE)
{
    // Get the CodeIgniter super object
    $CI =& get_instance();
    $ext = strchr($image_path, '.');
    $file_name = substr(basename($image_path), 0, -strlen($ext));
    // Path to image thumbnail
    $image_thumb = dirname($image_path) . '/' . $file_name . '_' . $height . '_' . $width . $ext;
    if (!file_exists($image_thumb)) {
        // LOAD LIBRARY
        $CI->load->library('image_lib');
        // CONFIGURE IMAGE LIBRARY
        $config['image_library'] = 'gd2';
        $config['source_image'] = $image_path;
        $config['new_image'] = $image_thumb;
        $config['maintain_ratio'] = $ratio;
        $config['height'] = $height;
        $config['width'] = $width;
        $CI->image_lib->initialize($config);
        if ($crop) {
            $CI->image_lib->crop();
        } else {
            $CI->image_lib->resize();
        }
        $CI->image_lib->clear();
    }
    return '<img src="' . dirname($_SERVER['SCRIPT_NAME']) . '/' . $image_thumb . '" onerror="loadNoPic(this,\'' . base_url() . '\')"/>';
}
开发者ID:Ankitj13,项目名称:sss,代码行数:28,代码来源:image_helper.php

示例11: updateCarousel

 public function updateCarousel($id)
 {
     $req = $this->app->request();
     $imageName = $_FILES['image']['name'];
     $imageTmp = $_FILES['image']['tmp_name'];
     $uniqueID = md5(uniqid(rand(), true));
     $fileType = strchr($imageName, '.');
     $newUpload = 'assets/img_public/' . $uniqueID . $fileType;
     if ($imageName != null) {
         unlink(carousel::showImagecarousel($id));
     }
     move_uploaded_file($imageTmp, $newUpload);
     @chmod($newUpload, 0777);
     if ($imageName != null) {
         $sql = 'UPDATE carousels SET image = :image, title = :title, description = :description where carousel_id = :id';
     } else {
         $sql = 'UPDATE carousels SET title = :title, description = :description where carousel_id = :id';
     }
     $this->carousels = parent::connect()->prepare($sql);
     if ($imageName != null) {
         $this->carousels->bindValue(':image', $newUpload);
     }
     $this->carousels->bindValue(':title', $req->post('title'));
     $this->carousels->bindValue(':description', $req->post('description'));
     $this->carousels->bindValue(':id', $id);
     try {
         $this->carousels->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
开发者ID:Rotron,项目名称:ecommerce,代码行数:31,代码来源:Carousel.php

示例12: fputcsv

 static function fputcsv($handle, $row, $fd = ',', $quot = '"')
 {
     $str = '';
     $nums = count($row);
     $i = 1;
     foreach ($row as $cell) {
         $cell = trim($cell);
         if (!self::detectUTF8($cell)) {
             $cell = @iconv('gb2312', 'utf-8', $cell);
         }
         //
         if (empty($cell)) {
             continue;
         }
         $cell = str_replace(array($quot, "\n"), array($quot . $quot, ''), $cell);
         if ($i < $nums) {
             if ($fd && strchr($cell, $fd) !== FALSE || strchr($cell, $quot) !== FALSE) {
                 $str .= $quot . $cell . $quot . $fd;
             } else {
                 $str .= $cell . $fd;
             }
         } else {
             $str .= $cell . $quot;
         }
         $i++;
     }
     fputs($handle, substr($str, 0, -1) . "\n");
     return strlen($str);
 }
开发者ID:rocketyang,项目名称:mincms,代码行数:29,代码来源:Csv.php

示例13: FindCitiesByNameLocal

 /**
  * Finds cities on given name and country
  *
  * @param string $p_cityName
  * @param string $p_countryCode
  *
  * @return array
  */
 public function FindCitiesByNameLocal($p_cityName, $p_countryCode = '')
 {
     global $g_ado_db;
     $cityName_changed = str_replace(' ', '%', trim($p_cityName));
     $is_exact = !strchr($p_cityName, '%');
     $queryStr = 'SELECT DISTINCT id, city_name as name, country_code as country, population, X(position) AS latitude, Y(position) AS longitude
         FROM ' . $this->m_dbTableName . ' WHERE city_name LIKE ?';
     if (!empty($p_countryCode)) {
         $queryStr .= ' AND cl.country_code = ?';
     }
     $sql_params = array($p_cityName, $cityName_changed, $cityName_changed . '%', '%' . $cityName_changed . '%');
     $queryStr .= ' GROUP BY id ORDER BY population DESC, id LIMIT 100';
     $cities = array();
     foreach ($sql_params as $param) {
         $params = array($param);
         if (!empty($p_countryCode)) {
             $params[] = (string) $p_countryCode;
         }
         $rows = $g_ado_db->GetAll($queryStr, $params);
         foreach ((array) $rows as $row) {
             $one_town_info = (array) $row;
             $one_town_info['provider'] = 'GN';
             $one_town_info['copyright'] = 'Data © GeoNames.org, CC-BY';
             $cities[] = $one_town_info;
         }
         if (!empty($cities)) {
             break;
         }
     }
     return $cities;
 }
开发者ID:sourcefabric,项目名称:newscoop,代码行数:39,代码来源:GeoNames.php

示例14: parseRow

 /**
  * Returns an event!
  * @param <type> $dayName
  * @param <type> $row
  * @return <type>
  */
 private static function parseRow($row)
 {
     $event = new WPlan_Event();
     if ($row == "...") {
         $event->empty = TRUE;
         return $event;
     }
     $event->empty = FALSE;
     $parts = explode(',', $row);
     $i = 0;
     foreach ($parts as $part) {
         $part = trim($part);
         switch ($i) {
             case 0:
                 $times = WPlan::parseTimes($part);
                 $event->from = $times['from'];
                 $event->to = $times['to'];
                 break;
             case 1:
                 $event->name = $part;
                 break;
             case 2:
                 $sep = ' ';
                 if (strchr($part, '/')) {
                     $sep = '/';
                 }
                 $event->sensei = explode($sep, $part);
                 break;
             default:
                 $event->info[] = $part;
         }
         $i += 1;
     }
     return $event;
 }
开发者ID:vladdu,项目名称:weekplan,代码行数:41,代码来源:wplan.php

示例15: 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


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