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


PHP convert函数代码示例

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


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

示例1: callOnce

function callOnce($url, $args = null, $method = "post", $withCookie = false, $timeout = CURL_TIMEOUT, $headers = array())
{
    /*{{{*/
    $ch = curl_init();
    if ($method == "post") {
        $data = convert($args);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
        curl_setopt($ch, CURLOPT_POST, 1);
    } else {
        $data = convert($args);
        if ($data) {
            if (stripos($url, "?") > 0) {
                $url .= "&{$data}";
            } else {
                $url .= "?{$data}";
            }
        }
    }
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    if (!empty($headers)) {
        curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
    }
    if ($withCookie) {
        curl_setopt($ch, CURLOPT_COOKIEJAR, $_COOKIE);
    }
    $r = curl_exec($ch);
    curl_close($ch);
    return $r;
}
开发者ID:firsteam,项目名称:falcons,代码行数:31,代码来源:baidu_transapi.php

示例2: cookContent

function cookContent($articleModule, $page)
{
    global $db_windpost;
    $content = $articleModule->getPageContent($page);
    $articleModule->showError();
    //$content = showface($content);
    $content = str_replace(array(" "), ' ', $content);
    $content = str_replace(array("\n", "\r\n"), '<br />', trim($content, "\r\n \n \r"));
    if ($articleModule->ifAttach && is_array($articleModule->attach)) {
        $aids = attachment($articleModule->content);
    }
    $endAttachs = array();
    foreach ($articleModule->attach as $at) {
        if (in_array($at['attach_id'], $aids)) {
            $content = cmsAttContent($content, $at);
        } elseif ($page == $articleModule->getPageCount()) {
            $endAttachs[] = $at;
        }
    }
    $content = convert($content, $db_windpost);
    foreach ($endAttachs as $value) {
        $html = getAttachHtml($value);
        $content .= $html;
    }
    return $content;
}
开发者ID:jechiy,项目名称:PHPWind,代码行数:26,代码来源:m_view.php

示例3: NetPlayer_LoadFiles

	function NetPlayer_LoadFiles ($cd_path) {
	  	//Get Directory to Load
	  	SetValue(NP_ID_CDDIRECTORYPATH, $cd_path);

	  	// Get PlayList
	  	$playlist = array();
	  	NetPlayer_GetPlayList ($cd_path, $playlist);
	  	NetPlayer_CopyCoverFile ($cd_path);

	  	// Leeren der vorher bestehenden Playlist:
		$player = NetPlayer_GetIPSComponentPlayer();
		$player->ClearPlaylist();
	  	$tracklist = "";

	   // Durchlaufen des Playlist-Arrays und anhängen an die Mediaplayer-Instanz-Playlist
	   $idx = 1;
	   foreach($playlist as $data)
	   {
	      IPSLogger_Dbg(__file__, "Add File=".$data);
			$player->AddPlaylist($data);
	      $tracklist.='<tr><td><div id="rc_mp_track'.$idx.'" track="'.$idx.'" class="containerControlTrack">'.convert(basename($data))."</div></td></tr>";
	      $idx++;
	   }
	   SetValue(NP_ID_CDTRACKLISTHTML, $tracklist);
		$player->Play();

	   $Directory = basename($cd_path);
	   SetValue(NP_ID_CDINTERPRET, substr($Directory,0,strpos($Directory, "[")));
	   SetValue(NP_ID_CDALBUM, substr($Directory,strpos($Directory, "[")+1, strpos($Directory, "]")-strpos($Directory, "[")-1));
   }
开发者ID:KOS-CH,项目名称:IPSLibrary,代码行数:30,代码来源:NetPlayer_LoadFiles.inc.php

示例4: generate_xml

function generate_xml($tables)
{
    $out = '<?xml version="1.0" ?>' . "\n";
    $out .= '<!-- PHP/ODBC XML export -->' . "\n";
    $out .= '<sql>' . "\n";
    foreach ($tables as $tmp) {
        $name = $tmp[2];
        $cols = $tmp[0];
        $out .= "\t" . '<table title="' . $name . '" >' . "\n";
        for ($i = 0; $i < count($cols); $i++) {
            $col = $cols[$i];
            $str = '';
            if ($col['nn']) {
                $str .= ' nn="nn"';
            }
            if ($col['pk']) {
                $str .= ' pk="pk"';
            }
            if ($col['special']) {
                /* spec */
                $str .= ' special="' . $col['special'] . '"';
            }
            $out .= "\t\t" . '<row' . $str . '>' . "\n";
            $out .= "\t\t\t" . '<title>' . $col['name'] . '</title>' . "\n";
            $out .= "\t\t\t" . '<default>' . $col['default'] . '</default>' . "\n";
            $out .= "\t\t\t" . '<type>' . convert($col['type']) . '</type>' . "\n";
            $out .= "\t\t" . '</row>' . "\n";
        }
        $out .= "\t" . '</table>' . "\n";
    }
    /* pokud tabulka existuje */
    $out .= '</sql>' . "\n";
    echo $out;
}
开发者ID:keyur-rathod,项目名称:web2py-appliances,代码行数:34,代码来源:import.php

示例5: test03ToUTF8

 public function test03ToUTF8()
 {
     $this->assertTrue(function_exists('convert'));
     $word = '中文Englis混合' . __FUNCTION__;
     $this->assertEquals($word, convert($word));
     $this->assertEquals($word, convert(iconv('UTF-8', 'GBK', $word)));
 }
开发者ID:jl9n,项目名称:CuteLib,代码行数:7,代码来源:CommonTest.php

示例6: scanner

function scanner($path)
{
    global $REGISTERED_MEDIA_EXTENSION, $FROM_DIR, $TO_DIR;
    $handle = opendir($path);
    while ($f = readdir($handle)) {
        if (filetype($path . $f) == 'dir') {
            if ($f != '.' && $f != '..') {
                $dir = $path . $f;
                $new_dir = str_replace($FROM_DIR, $TO_DIR, $dir);
                if (!file_exists($new_dir)) {
                    mkdir($new_dir);
                }
                scanner($path . $f . "/");
            }
        } elseif (filetype($path . $f) == 'file') {
            if (preg_match("/\\.(" . $REGISTERED_MEDIA_EXTENSION . ")\$/i", $f)) {
                $file = $path . $f;
                $file = preg_replace("/\\.(" . $REGISTERED_MEDIA_EXTENSION . ")\$/i", ".mp4", $file);
                if (!file_exists(str_replace($FROM_DIR, $TO_DIR, $file))) {
                    convert($path . $f, str_replace($FROM_DIR, $TO_DIR, $file));
                }
            }
        } else {
            echo "unknown\n";
        }
    }
    closedir($handle);
}
开发者ID:vrevyuk,项目名称:perecoder,代码行数:28,代码来源:_.php

示例7: postMusic

function postMusic($sUploadedFile, $aFileInfo)
{
    global $oDb;
    global $sFilesPathMp3;
    $sId = $aFileInfo['author'];
    if ($sUploadedFile != "") {
        $sTempFile = $sFilesPathMp3 . $sId . TEMP_FILE_NAME;
        @unlink($sTempFile);
        if (!is_uploaded_file($sUploadedFile)) {
            return false;
        }
        move_uploaded_file($sUploadedFile, $sTempFile);
        if (!convert($sId, $aFileInfo['mp3'])) {
            deleteTempMp3s($sId);
            return false;
        }
        if (!$aFileInfo['mp3']) {
            $oDb->reconnect();
        }
    }
    $aResult = initFile($sId, $aFileInfo['category'], addslashes($aFileInfo['title']), addslashes($aFileInfo['tags']), addslashes($aFileInfo['description']));
    if ($aResult['status'] == SUCCESS_VAL) {
        return $aResult['file'];
    } else {
        return false;
    }
}
开发者ID:noormcs,项目名称:studoro,代码行数:27,代码来源:customFunctions.inc.php

示例8: memory_and_gc

/**
 *
 * @ignore
 */
function memory_and_gc($str)
{
    $before = memory_get_usage(true);
    gc_enable();
    $gcs = gc_collect_cycles();
    $after = memory_get_usage(true);
    print "Memory usage at the {$str} : " . convert($before) . ". After GC: " . convert($after) . " and freed {$gcs} variables\n";
}
开发者ID:shpapy,项目名称:pan-configurator,代码行数:12,代码来源:panconfigurator.php

示例9: toE164

function toE164($data)
{
    $line = $data['src'];
    $gibs = $data['gibs'];
    $gibs[3] = convert($gibs[3]);
    $gibs[5] = convert($gibs[5]);
    $line = implode("\t", $gibs);
    return array('src' => $line, 'gibs' => $gibs);
}
开发者ID:nolka,项目名称:logconverter,代码行数:9,代码来源:2toE164.php

示例10: mb_explode

function mb_explode($separator, $string)
{
    $sepEnc = mb_detect_encoding($separator, "GBK, UTF-8");
    $strEnc = mb_detect_encoding($string, "GBK, UTF-8");
    if ($strEnc != $sepEnc) {
        $separator = convert($separator, $sepEnc, $strEnc);
    }
    return explode($separator, $string);
}
开发者ID:mrzeng,项目名称:raxprint,代码行数:9,代码来源:api.php

示例11: status

 public function status($x)
 {
     $NR = "<span class='badge badge-warning'>Not Recommended</span>";
     $Re = "<span class='badge badge-info'>Recommended</span>";
     if (convert(disk_total_space($x), FALSE) < 100) {
         return $NR;
     }
     if (convert(disk_total_space($x), FALSE) >= 100) {
         return $Re;
     }
 }
开发者ID:johnjoshualipio,项目名称:lcwd_dtms,代码行数:11,代码来源:ShowDisk.php

示例12: im_ali

function im_ali($id, $style = 0)
{
    if ($id) {
        if (!check_name($id) && strtoupper(DT_CHARSET) != 'UTF-8') {
            $id = convert($id, 'GBK', 'UTF-8');
        }
        $id = urlencode($id);
        return '<a href="http://amos.alicdn.com/msg.aw?v=2&uid=' . $id . '&site=cnalichn&s=6&charset=UTF-8" target="_blank" rel="nofollow"><img src="http://amos.alicdn.com/online.aw?v=2&uid=' . $id . '&site=cnalichn&s=6&charset=UTF-8" title="点击旺旺交谈/留言" alt="" align="absmiddle" onerror="this.src=DTPath+\'file/image/ali-off.gif\';" onload="if(this.width>20)this.src=SKPath+\'image/ali-off.gif\';"/></a>';
    }
    return '';
}
开发者ID:hcd2008,项目名称:destoon,代码行数:11,代码来源:im.func.php

示例13: processing

 function processing()
 {
     global $sModule;
     global $sFfmpegPath;
     global $sFilesPathMp3;
     $iFilesCount = getSettingValue($sModule, "processCount");
     if (!is_numeric($iFilesCount)) {
         $iFilesCount = 2;
     }
     $iFailedTimeout = getSettingValue($sModule, "failedTimeout");
     if (!is_numeric($iFailedTimeout)) {
         $iFailedTimeout = 1;
     }
     $iFailedTimeout *= 86400;
     $sDbPrefix = DB_PREFIX . ucfirst($sModule);
     $iCurrentTime = time();
     do {
         //remove all tokens older than 10 minutes
         if (!getResult("DELETE FROM `" . $sDbPrefix . "Tokens` WHERE `Date`<'" . ($iCurrentTime - 600) . "'")) {
             break;
         }
         if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Date`='" . $iCurrentTime . "', `Status`='" . STATUS_FAILED . "' WHERE `Status`='" . STATUS_PROCESSING . "' AND `Date`<'" . ($iCurrentTime - $iFailedTimeout) . "'")) {
             break;
         }
         $rResult = getResult("SELECT * FROM `" . $sDbPrefix . "Files` WHERE `Status`='" . STATUS_PENDING . "' ORDER BY `ID` LIMIT " . $iFilesCount);
         if (!$rResult) {
             break;
         }
         for ($i = 0; $i < $rResult->rowCount(); $i++) {
             $aFile = $rResult->fetch();
             if (convert($aFile['ID'])) {
                 $sType = 'bx_sounds';
                 //album counter & cover update
                 if (getSettingValue($sModule, "autoApprove") == TRUE_VAL) {
                     $oAlbum = new BxDolAlbums($sType);
                     $oAlbum->updateObjCounterById($aFile['ID']);
                     if (getParam($oAlbum->sAlbumCoverParam) == 'on') {
                         $oAlbum->updateLastObjById($aFile['ID']);
                     }
                 }
                 $oTag = new BxDolTags();
                 $oTag->reparseObjTags($sType, $aFile['ID']);
                 $oCateg = new BxDolCategories($aFile['Owner']);
                 $oCateg->reparseObjTags($sType, $aFile['ID']);
             } else {
                 if (!getResult("UPDATE `" . $sDbPrefix . "Files` SET `Status`='" . STATUS_FAILED . "' WHERE `ID`='" . $aFile['ID'] . "'")) {
                     break;
                 }
             }
         }
     } while (false);
 }
开发者ID:Prashank25,项目名称:dolphin.pro,代码行数:52,代码来源:BxDolCronMp3.php

示例14: utf8_to_ascii

function utf8_to_ascii($str = '')
{
    $str_lower = convert($str);
    $chars = array('a' => array('a', 'á', 'à', 'ả', 'ạ', 'ã', 'â', 'ấ', 'ầ', 'ẩ', 'ậ', 'ẫ', 'ă', 'ắ', 'ằ', 'ẳ', 'ặ', 'ẵ'), 'b' => array('b'), 'c' => array('c'), 'd' => array('d', 'đ'), 'e' => array('e', 'é', 'è', 'ẻ', 'ẹ', 'ẽ', 'ê', 'ế', 'ề', 'ể', 'ệ', 'ễ'), 'f' => array('f'), 'g' => array('g'), 'h' => array('h'), 'j' => array('j'), 'k' => array('k'), 'l' => array('l'), 'm' => array('m'), 'n' => array('n'), 'i' => array('i', 'í', 'ì', 'ỉ', 'ị', 'ĩ'), 'o' => array('o', 'ó', 'ò', 'ỏ', 'õ', 'ọ', 'ỡ', 'ơ', 'ớ', 'ờ', 'ở', 'ợ', 'ô', 'ố', 'ồ', 'ổ', 'ộ', 'ỗ'), 'u' => array('u', 'ú', 'ù', 'ủ', 'ũ', 'ụ', 'ú', 'ư', 'ứ', 'ừ', 'ử', 'ữ', 'ự'), 'y' => array('y', 'ý', 'ỳ', 'ỵ', 'ỷ', 'ỹ'), 'q' => array('q'), 'w' => array('w'), 'r' => array('r'), 't' => array('t'), 'p' => array('p'), 's' => array('s'), 'z' => array('z'), 'x' => array('x'), 'v' => array('v'), '-' => array(' '));
    foreach ($chars as $k => $v) {
        foreach ($v as $char) {
            $str_lower = str_replace($char, $k, $str_lower);
        }
    }
    $str_lower = preg_replace('/[^a-z0-9\\s-.]/i', NULL, $str_lower);
    $str_lower = preg_replace('#[-]{1,}#u', '-', $str_lower);
    return trim($str_lower);
}
开发者ID:ngothanhduoc,项目名称:wap_tao,代码行数:13,代码来源:alias_helper.php

示例15: bottles

function bottles($start)
{
    for ($i = $start; $i > 0; $i--) {
        $current = convert($i);
        $next = convert($i - 1);
        if ($i == 1) {
            print $current . " bottle of beer on the wall. </br>" . $current . " bottle of beer! </br>\r\n\t\t\t\t\t\t  take one down, pass it around, </br> " . $next . " bottles of beer on the wall.</br></br>";
        } elseif ($i == 2) {
            print $current . " bottles of beer on the wall. </br>" . $current . " bottles of beer! </br>\r\n\t\t\t\t\t\t  take one down, pass it around, </br>" . $next . " bottle of beer on the wall. </br></br>";
        } else {
            print $current . " bottles of beer on the wall. </br>" . $current . " bottles of beer! </br>\r\n\t\t\t\t\t\t  take one down, pass it around, </br>" . $next . " bottles of beer on the wall. </br></br>";
        }
    }
}
开发者ID:yorker78,项目名称:CSSE280,代码行数:14,代码来源:bottles.php


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