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

PHP mid函数代码示例

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

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



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

示例1: getArray

function getArray($content, $startStr, $endStr, $startType, $endType)
{
    $s = "";
    $i = "";
    $listStr = "";
    for ($i = 0; $i <= 999; $i++) {
        //30为截取条件
        //echo($content . "=" . instr($content, $startStr));
        if (instr($content, $startStr) > 0 && instr($content, $endStr) > 0) {
            $s = mid($content, 1, instr($content, $endStr) + 1);
            //echo("    s=" . $s . "<br>");
            $content = mid($content, instr($content, $endStr) + strlen($endStr), -1);
            $s = mid($s, instr($s, $startStr) + strlen($startStr), -1);
            //echo("    s2=" . $s . "<br>");
            $s = substr($s, 0, strlen($s) - strlen($endStr));
            if ($startType == true) {
                $s = $startStr . $s;
            }
            if ($endType == true) {
                $s = $s . $endStr;
            }
            if ($listStr != "") {
                $listStr = $listStr . '$Array$';
            }
            $listStr = $listStr . $s;
        } else {
            break;
        }
    }
    $GetArray = $listStr;
    return @$GetArray;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:32,代码来源:sys_Cai.php


示例2: extractColors

function extractColors($Hexa)
{
    if (strlen($Hexa) != 6) {
        return array(0, 0, 0);
    }
    $R = hexdec(left($Hexa, 2));
    $G = hexdec(mid($Hexa, 3, 2));
    $B = hexdec(right($Hexa, 2));
    return array($R, $G, $B);
}
开发者ID:AitorMotril,项目名称:eduGraph,代码行数:10,代码来源:graficoAsignaturas.php


示例3: getFormFieldList

function getFormFieldList()
{
    $s = '';
    $c = '';
    $splstr = '';
    $fieldName = '';
    $splstr = aspSplit(@$_POST, '&');
    foreach ($splstr as $key => $s) {
        $fieldName = lCase(mid($s, 1, inStr($s, '=') - 1));
        if ($c != '') {
            $c = $c . '|';
        }
        $c = $c . $fieldName;
    }
    $getFormFieldList = $c;
    return @$getFormFieldList;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:17,代码来源:2014_Form.php


示例4: getWhereAnd

function getWhereAnd($sql, $addSql)
{
    $LCaseAddSql = '';
    $AddType = '';
    $s = '';
    //追加SQl为空则退出
    if (aspTrim($addSql) == '') {
        $getWhereAnd = $sql;
        return @$getWhereAnd;
    }
    if (inStr(lCase($sql), ' where ') > 0) {
        $AddType = ' And ';
    } else {
        $AddType = ' Where ';
    }
    if ($addSql != '') {
        $addSql = aspTrim($addSql);
        $LCaseAddSql = lCase($addSql);
        if (left($LCaseAddSql, 6) == 'order ' || left($LCaseAddSql, 6) == 'group ') {
            $getWhereAnd = $sql . ' ' . $addSql;
            return @$getWhereAnd;
            //改进必需加空格,因为前面已经删除了20160115
        } else {
            if (left($LCaseAddSql, 6) == 'where ') {
                $addSql = mid($addSql, 7, -1);
            } else {
                if (left($LCaseAddSql, 4) == 'and ') {
                    $addSql = mid($addSql, 5, -1);
                }
            }
        }
        //对where 改进   20160623
        $s = lCase($addSql);
        if ($s != 'and' && $s != 'or' && $s != 'where') {
            $sql = $sql . $AddType . $addSql;
        }
    }
    $getWhereAnd = $sql;
    return @$getWhereAnd;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:40,代码来源:ASPPHPAccess.php


示例5: StrCut

function StrCut($Content, $StartStr, $EndStr, $CutType)
{
    //On Error Resume Next
    $S1 = '';
    $S1Str = '';
    $S2 = '';
    $S3 = '';
    if (instr($Content, $StartStr) == false || instr($Content, $EndStr) == false) {
        $StrCut = '';
        return @$StrCut;
    }
    switch ($CutType) {
        //完善于20150923
        case 1:
            $S1 = instr($Content, $StartStr);
            $S1Str = mid($Content, $S1 + strlen($StartStr), -1);
            $S2 = $S1 + instr($S1Str, $EndStr) + strlen($StartStr) + strlen($EndStr) - 1;
            //为什么要减人
            break;
        case 2:
            0;
            '';
            $S1 = instr($Content, $StartStr) + strlen($StartStr);
            $S1Str = mid($Content, $S1, -1);
            //S2 = InStr(S1, Content, EndStr)
            $S2 = $S1 + instr($S1Str, $EndStr) - 1;
            //call echo("s2",s2)
    }
    $S3 = $S2 - $S1;
    if ($S3 >= 0) {
        $StrCut = mid($Content, $S1, $S3);
    } else {
        $StrCut = '';
    }
    return @$StrCut;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:36,代码来源:startInstall.php


示例6: haveChina

function haveChina($content)
{
    $i = '';
    $j = '';
    $haveChina = false;
    for ($i = 1; $i <= len($content); $i++) {
        $j = asc(mid($content, $i, 1));
        //是汉字累加
        if ($j < 0) {
            if (($j <= -22033 && $j >= -24158) == false) {
                $haveChina = true;
                return @$haveChina;
            }
        }
    }
    return @$haveChina;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:17,代码来源:StringNumber.php


示例7: handleSqlTop

 function handleSqlTop($sql)
 {
     $s = "";
     $nLength = "";
     $leftStr = "";
     $rightStr = "";
     $nRow = "";
     $s = LCase($sql);
     $nLength = instr($s, " top ");
     $nSelect = instr(lcase($s), "select ");
     if ($nLength > 0 && $nSelect > 0) {
         //只允许查询有显示多少条的限制 20160408
         $leftStr = mid($sql, 1, $nLength);
         $rightStr = mid($sql, $nLength + 5, -1);
         $rightStr = AspTrim($rightStr);
         $nRow = mid($rightStr, 1, instr($rightStr, " "));
         $rightStr = mid($rightStr, instr($rightStr, " "), -1);
         //call echo("nRow",nRow)
         //call echo("leftStr",leftStr)
         //call echo("rightStr",rightStr)
         $sql = $leftStr . $rightStr . " limit " . $nRow;
     }
     $handleSqlTop = $sql;
     return @$handleSqlTop;
 }
开发者ID:313801120,项目名称:AspPhpCms,代码行数:25,代码来源:MySqlClass.php


示例8: handleWithWebSiteList

function handleWithWebSiteList($httpurl, $urllist)
{
    $website = '';
    $splstr = '';
    $url = '';
    $c = '';
    $urlWebsite = '';
    $s = '';
    $website = lCase(getWebSite($httpurl));
    $splstr = aspSplit($urllist, vbCrlf());
    foreach ($splstr as $key => $url) {
        if ($url != '') {
            if (right($url, 1) != '/' && inStr($url, '?') == false) {
                $s = mid($url, inStrRev($url, '/'), -1);
                //call echo("s",s)
                if ((inStr($s, '.') == false || inStr($s, '.com') > 0 || inStr($s, '.cn') > 0 || inStr($s, '.net') > 0) && inStr($s, '@') == false) {
                    $url = $url . '/';
                }
                //call echo("url",url)
            }
            $urlWebsite = lCase(getWebSite($url));
            if ($website == $urlWebsite && inStr(vbCrlf() . $c . vbCrlf(), vbCrlf() . $url . vbCrlf()) == false) {
                if ($c != '') {
                    $c = $c . vbCrlf();
                }
                $c = $c . $url;
            }
        }
    }
    $handleWithWebSiteList = $c;
    return @$handleWithWebSiteList;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:32,代码来源:URL.php


示例9: getHtmlValue

function getHtmlValue($content, $sType)
{
    $i = '';
    $endStr = '';
    $s = '';
    $labelName = '';
    $startLabel = '';
    $endLabel = '';
    $LCaseEndStr = '';
    $paramName = '';
    $startLabel = '<';
    $endLabel = '>';
    for ($i = 1; $i <= len($content); $i++) {
        $s = mid($content, $i, 1);
        $endStr = mid($content, $i, -1);
        if ($s == '<') {
            if (inStr($endStr, '>') > 0) {
                $s = mid($endStr, 1, inStr($endStr, '>'));
                $i = $i + len($s) - 1;
                $s = mid($s, 2, len($s) - 2);
                $s = PHPTrim($s);
                if (right($s, 1) == '/') {
                    $s = PHPTrim(left($s, len($s) - 1));
                }
                $endStr = right($endStr, len($endStr) - len($s) - 2);
                //最后字符减去当前标签  -2是因为它有<>二个字符
                //注意之前放在labelName下面
                $labelName = mid($s, 1, inStr($s . ' ', ' ') - 1);
                $labelName = lCase($labelName);
                if ($labelName == 'title' && $sType == 'webtitle') {
                    $LCaseEndStr = lCase($endStr);
                    if (inStr($LCaseEndStr, '</title>') > 0) {
                        $s = mid($endStr, 1, inStr($LCaseEndStr, '</title>') - 1);
                    } else {
                        $s = '';
                    }
                    $getHtmlValue = $s;
                    return @$getHtmlValue;
                } else {
                    if ($labelName == 'meta' && ($sType == 'webkeywords' || $sType == 'webdescription')) {
                        $LCaseEndStr = lCase($endStr);
                        $paramName = PHPTrim(lCase(getParamValue($s, 'name')));
                        if ('web' . $paramName == $sType) {
                            $getHtmlValue = getParamValue($s, 'content');
                            return @$getHtmlValue;
                        }
                    }
                }
            }
        }
    }
    $getHtmlValue = '';
    return @$getHtmlValue;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:54,代码来源:Html.php


示例10: foreach

$nCount = 0;
foreach ($splStr as $s) {
    $tempS = $s;
    $s = AspTrim($s);
    if ($tempS != '' && substr(phptrim($s) . ' ', 0, 1) != '#') {
        $nCount = $nCount + 1;
        //总数
        if (substr($tempS, 0, 4) == '    ') {
        } else {
            $parentid = '-1';
        }
        if (trim(LCase($tempS)) == 'end') {
            break;
        } else {
            if (trim($s) != '') {
                $title = mid($s . ' ', 1, instr($s . ' ', ' ') - 1);
                $lableName = getStrCut($s, 'lablename=\'', '\'', 2);
                $url = getStrCut($s, 'url=\'', '\'', 2);
                $isdisplay = getStrCut($s, 'isdisplay=\'', '\'', 2);
                if ($isdisplay == '') {
                    $isdisplay = 1;
                }
                //ASPEcho('lablename', $lableName) ;
                if ($title != '') {
                    connExecute('insert into ' . $DB_PREFIX . 'ListMenu (title,parentid,sortrank,lablename,isdisplay,customaurl) values(\'' . $title . '\',' . $parentid . ',' . $nCount . ',\'' . $lableName . '\',' . $isdisplay . ',\'' . $url . '\')');
                    if ($parentid == '-1') {
                        $rsObj = $GLOBALS['conn']->query('select * from ' . $DB_PREFIX . 'ListMenu where title=\'' . $title . '\'');
                        $rs = mysql_fetch_array($rsObj);
                        if (@mysql_num_rows($rsObj) != 0) {
                            $parentid = $rs['id'];
                        }
开发者ID:313801120,项目名称:AspPhpCms,代码行数:31,代码来源:Install.php


示例11: deg2rad

 //$planet_angle[$sort_pos[$i]] = ($chart_idx * (3 * $deg_in_each_house) / (3 * $max_num_pl_in_each_house)) + ($deg_in_each_house / (2 * $max_num_pl_in_each_house));    // needed for aspect lines
 $planet_angle[$sort_pos[$i]] = $sort[$i];
 $angle_to_use = $planet_angle[$sort_pos[$i]] - $Ascendant;
 // needed for placing info on chartwheel
 // denote that we have done at least one planet in this house (actually count the planets in this house that we have done)
 $planets_done++;
 // display the planet in the wheel
 $angle_to_use = deg2rad($angle_to_use);
 if ($flag == False) {
     display_planet_glyph($angle_to_use, $radius - $dist_from_diameter1, $xy);
 } else {
     display_planet_glyph($angle_to_use, $radius - $dist_from_diameter2, $xy);
 }
 imagettftext($im, 16, 0, $xy[0] + $center_pt, $xy[1] + $center_pt, $planet_color, FONTPATH . HAMBURG_TTF, chr($pl_glyph[$sort_pos[$i]]));
 // display degrees of longitude for each planet
 if (strtoupper(mid($retrograde, $sort_pos[$i] + 1, 1)) == "R") {
     $t = sprintf("%.1f", Reduce_below_30($sort[$i])) . " r";
 } else {
     $t = sprintf("%.1f", Reduce_below_30($sort[$i]));
 }
 //draw line from planet to circumference
 if ($flag == False) {
     $x1 = (-$radius + $dist_from_diameter1a) * cos($angle_to_use);
     $y1 = ($radius - $dist_from_diameter1a) * sin($angle_to_use);
     $x2 = (-$radius + 6) * cos($angle_to_use);
     $y2 = ($radius - 6) * sin($angle_to_use);
 } else {
     $x1 = (-$radius + $dist_from_diameter2a) * cos($angle_to_use);
     $y1 = ($radius - $dist_from_diameter2a) * sin($angle_to_use);
     $x2 = (-$radius + 6) * cos($angle_to_use);
     $y2 = ($radius - 6) * sin($angle_to_use);
开发者ID:pumi11,项目名称:astro,代码行数:31,代码来源:composite_wheel.php


示例12: PHPStr_Split

function PHPStr_Split($content, $Split_Length)
{
    $i = '';
    $s = '';
    $c = '';
    $n = '';
    $ArrStr = aspArray(99);
    $nArray = '';
    if ($Split_Length <= 0) {
        $Split_Length = 1;
    }
    $n = 0;
    $nArray = 0;
    for ($i = 1; $i <= len($content); $i++) {
        $s = mid($content, $i, 1);
        $c = $c . $s;
        $n = $n + 1;
        if ($n == $Split_Length) {
            $ArrStr[$nArray] = $c;
            $c = '';
            $n = 0;
            $nArray = $nArray + 1;
        }
    }
    $PHPStr_Split = $ArrStr;
    return @$PHPStr_Split;
}
开发者ID:313801120,项目名称:AspPhpCms,代码行数:27,代码来源:2014_Array.php


示例13: scanUrl

function scanUrl($httpUrl, $toTitle, $codeset)
{
    $splStr = '';
    $i = '';
    $s = '';
    $content = '';
    $PubAHrefList = '';
    $PubATitleList = '';
    $splUrl = '';
    $spltitle = '';
    $title = '';
    $url = '';
    $htmlDir = '';
    $htmlFilePath = '';
    $nOK = '';
    $dataArray = '';
    $webState = '';
    $u = '';
    $iniDir = '';
    $iniFilePath = '';
    $websize = '';
    $nSetTime = '';
    $startTime = '';
    $openSpeed = '';
    $isLocal = '';
    $isThrough = '';
    $htmlDir = '/../网站UrlScan/' . setFileName(getWebSite($httpUrl));
    CreateDirFolder($htmlDir);
    $htmlFilePath = $htmlDir . '/' . setFileName($httpUrl) . '.html';
    $iniDir = $htmlDir . '/conifg';
    CreateFolder($iniDir);
    $iniFilePath = $iniDir . '/' . setFileName($httpUrl) . '.txt';
    //httpurl="http://maiside.net/"
    $webState = 0;
    $nSetTime = 1;
    $openSpeed = 0;
    if (CheckFile($htmlFilePath) == false) {
        $startTime = now();
        aspEcho('codeset', $codeset);
        $dataArray = handleXmlGet($httpUrl, $codeset);
        $content = $dataArray[0];
        $content = toGB2312Char($content);
        //给PHP用,转成gb2312字符
        $webState = $dataArray[1];
        $openSpeed = dateDiff('s', $startTime, now());
        //content=gethttpurl(httpurl,codeset)
        //call createfile(htmlFilePath,content)
        WriteToFile($htmlFilePath, $content, $codeset);
        createFile($iniFilePath, $webState . vbCrlf() . $openSpeed);
        $nSetTime = 3;
        $isLocal = 0;
    } else {
        //content=getftext(htmlFilePath)
        $content = reaFile($htmlFilePath, $codeset);
        $content = toGB2312Char($content);
        //给PHP用,转成gb2312字符
        $splStr = aspSplit(getFText($iniFilePath), vbCrlf());
        $webState = CInt($splStr[0]);
        $openSpeed = CInt($splStr[0]);
        $isLocal = 1;
    }
    $websize = getFSize($htmlFilePath);
    if ($websize == '') {
        $websize = 0;
    }
    aspEcho('isLocal', $isLocal);
    $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $httpUrl . '\'');
    if (@mysql_num_rows($rsObj) == 0) {
        $rs = mysql_fetch_array($rsObj);
        connexecute('insert into ' . $GLOBALS['db_PREFIX'] . 'weburlscan(httpurl,title,charset) values(\'' . $httpUrl . '\',\'' . $toTitle . '\',\'' . $codeset . '\')');
    }
    connexecute('update ' . $GLOBALS['db_PREFIX'] . 'weburlscan  set webstate=' . $webState . ',websize=' . $websize . ',openspeed=' . $openSpeed . ',charset=\'' . $codeset . '\'  where httpurl=\'' . $httpUrl . '\'');
    //strLen(content)  不用这个,不精准
    $s = getContentAHref('', $content, $PubAHrefList, $PubATitleList);
    $s = handleScanUrlList($httpUrl, $s);
    //call echo("httpurl",httpurl)
    //call echo("s",s)
    //call echo("PubATitleList",PubATitleList)
    $nOK = 0;
    $splUrl = aspSplit($PubAHrefList, vbCrlf());
    $spltitle = aspSplit($PubATitleList, vbCrlf());
    for ($i = 1; $i <= uBound($splUrl); $i++) {
        $title = $spltitle[$i];
        $url = $splUrl[$i];
        //去掉#号后台的字符20160506
        if (inStr($url, '#') > 0) {
            $url = mid($url, 1, inStr($url, '#') - 1);
        }
        if ($url == '') {
            if ($title != '') {
                aspEcho('网址为空', $title);
            }
        } else {
            $url = handleScanUrlList($httpUrl, $url);
            $url = handleWithWebSiteList($httpUrl, $url);
            if ($url != '') {
                $rsObj = $GLOBALS['conn']->query('select * from ' . $GLOBALS['db_PREFIX'] . 'weburlscan where httpurl=\'' . $url . '\'');
                if (@mysql_num_rows($rsObj) == 0) {
                    $rs = mysql_fetch_array($rsObj);
                    $u = lCase($url);
//.........这里部分代码省略.........
开发者ID:313801120,项目名称:AspPhpCms,代码行数:101,代码来源:admin_function2.php


示例14: handleTransferChinese_temp

function handleTransferChinese_temp($content, $sType)
{
    $zd = '';
    $i = '';
    $s = '';
    $c = '';
    $zd = '�I�����}���@���K���۰��a���\\�ŠW�Ӊΰ��T�ڔ[�ܔ����C���k��O��Ͱ 

鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP midcom_show_style函数代码示例发布时间:2022-05-15
下一篇:
PHP microtime_ms函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap