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


PHP Explode函数代码示例

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


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

示例1: getPageName

function getPageName($currentURL = '')
{
    $currentFile = $currentURL == '' ? $_SERVER["PHP_SELF"] : $currentURL;
    $parts = Explode('/', $currentFile);
    $realurl = Explode('?', $parts[count($parts) - 1]);
    return $realurl[0];
}
开发者ID:AdyGun,项目名称:RiceShop,代码行数:7,代码来源:function.php

示例2: handle

 public function handle($instance, $serverKey, $parameters, $httpRequestMethod)
 {
     // Validate HTTP Verb
     if (strtolower($httpRequestMethod) != "get") {
         throw new MashapeException(EXCEPTION_INVALID_HTTPMETHOD, EXCEPTION_INVALID_HTTPMETHOD_CODE);
     }
     // Validate request
     if ($this->validateRequest($serverKey) == false) {
         throw new MashapeException(EXCEPTION_AUTH_INVALID_SERVERKEY, EXCEPTION_AUTH_INVALID_SERVERKEY_CODE);
     }
     $resultXml = "<?xml version=\"1.0\" ?>\n";
     $fileParts = Explode('/', $_SERVER["PHP_SELF"]);
     $scriptName = $fileParts[count($fileParts) - 1];
     $baseUrl = Explode("/" . $scriptName, $this->curPageURL());
     $resultXml .= "<api baseUrl=\"" . $baseUrl[0] . "\" " . $this->getSimpleInfo() . ">\n";
     $mode = isset($parameters[MODE]) ? $parameters[MODE] : null;
     $configuration = RESTConfigurationLoader::reloadConfiguration($serverKey);
     if ($mode == null || $mode != SIMPLE_MODE) {
         $objectsFound = array();
         $objectsToCreate = array();
         $methods = discoverMethods($instance, $configuration, $objectsFound, $objectsToCreate, $scriptName);
         $objects = discoverObjects($configuration, $objectsFound);
         $resultXml .= $methods . $objects . generateObjects($objectsToCreate);
         // Update the .htaccess file with the new route settings
         updateHtaccess($instance);
     }
     $resultXml .= "</api>";
     return $resultXml;
 }
开发者ID:ATouhou,项目名称:mashape-php-library,代码行数:29,代码来源:discover.php

示例3: current_pagename

function current_pagename()
{
    $currentFile = $_SERVER["PHP_SELF"];
    $parts = Explode('/', $currentFile);
    $mypage = $parts[count($parts) - 1];
    return $mypage;
}
开发者ID:pombredanne,项目名称:acmdev,代码行数:7,代码来源:functions.php

示例4: QueryMinecraft

function QueryMinecraft($IP, $Port = 25565, $Timeout = 2)
{
    $Socket = Socket_Create(AF_INET, SOCK_STREAM, SOL_TCP);
    Socket_Set_Option($Socket, SOL_SOCKET, SO_SNDTIMEO, array('sec' => (int) $Timeout, 'usec' => 0));
    Socket_Set_Option($Socket, SOL_SOCKET, SO_RCVTIMEO, array('sec' => (int) $Timeout, 'usec' => 0));
    if ($Socket === FALSE || @Socket_Connect($Socket, $IP, (int) $Port) === FALSE) {
        return FALSE;
    }
    Socket_Send($Socket, "þ", 2, 0);
    $Len = Socket_Recv($Socket, $Data, 512, 0);
    Socket_Close($Socket);
    if ($Len < 4 || $Data[0] !== "ÿ") {
        return FALSE;
    }
    $Data = SubStr($Data, 3);
    // Strip packet header (kick message packet and short length)
    $Data = iconv('UTF-16BE', 'UTF-8', $Data);
    // Are we dealing with Minecraft 1.4+ server?
    if ($Data[1] === "§" && $Data[2] === "1") {
        $Data = Explode("", $Data);
        return array('HostName' => $Data[3], 'Players' => IntVal($Data[4]), 'MaxPlayers' => IntVal($Data[5]), 'Protocol' => IntVal($Data[1]), 'Version' => $Data[2]);
    }
    $Data = Explode("§", $Data);
    return array('HostName' => SubStr($Data[0], 0, -1), 'Players' => isset($Data[1]) ? IntVal($Data[1]) : 0, 'MaxPlayers' => isset($Data[2]) ? IntVal($Data[2]) : 0, 'Protocol' => 0, 'Version' => '1.3');
}
开发者ID:payssion,项目名称:PHP-Minecraft-Query,代码行数:25,代码来源:MinecraftQuery_Simple.php

示例5: scriptname

function scriptname()
{
    $file = $_SERVER["SCRIPT_NAME"];
    $break = Explode('/', $file);
    $pfile = $break[count($break) - 1];
    return $pfile;
}
开发者ID:geoscience-community-codes,项目名称:IceWeb,代码行数:7,代码来源:scriptname.php

示例6: __construct

 public function __construct()
 {
     $path = Explode('/', $_SERVER["SCRIPT_NAME"]);
     $name = $path[count($path) - 1];
     $this->name = $name;
     $this->controllerName = preg_replace('/_view/', '_controller', $name);
 }
开发者ID:victornava,项目名称:notas,代码行数:7,代码来源:view.php

示例7: isAuthorized

function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup)
{
    // For security, start by assuming the visitor is NOT authorized.
    $isValid = False;
    // When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
    // Therefore, we know that a user is NOT logged in if that Session variable is blank.
    if (!empty($UserName)) {
        // Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
        // Parse the strings into arrays.
        $arrUsers = Explode(",", $strUsers);
        $arrGroups = Explode(",", $strGroups);
        /*if (in_array($UserName, $arrUsers)) { 
            $isValid = true; 
          } 
          // Or, you may restrict access to only certain users based on their username. 
          if (in_array($UserGroup, $arrGroups)) { 
            $isValid = true; 
          } 
          */
        if ($UserName == 'w3oitreasury') {
            $isValid = true;
        }
        /*
        	if (($strUsers == "") && true) { 
              $isValid = true; 
            } */
    }
    return $isValid;
}
开发者ID:W3AMD,项目名称:W3OI,代码行数:29,代码来源:editfromid.php

示例8: DB_Query

function DB_Query($Query)
{
    /******************************************************************************/
    $__args_types = array('string');
    #-------------------------------------------------------------------------------
    $__args__ = Func_Get_Args();
    eval(FUNCTION_INIT);
    /******************************************************************************/
    $Link =& Link_Get('DB');
    #-------------------------------------------------------------------------------
    if (!Is_Object($Link)) {
        #-------------------------------------------------------------------------------
        $Config = Config();
        #-------------------------------------------------------------------------------
        $Link = new MySQL($Config['DBConnection']);
        #-------------------------------------------------------------------------------
        if (Is_Error($Link->Open())) {
            #-------------------------------------------------------------------------------
            $Link = NULL;
            #-------------------------------------------------------------------------------
            return ERROR | @Trigger_Error('[DB_Query]: невозможно соединиться с базой данных');
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
        if (Is_Error($Link->SelectDB())) {
            #-------------------------------------------------------------------------------
            $Link = NULL;
            #-------------------------------------------------------------------------------
            return ERROR | @Trigger_Error('[DB_Query]: невозможно выбрать базу данных');
            #-------------------------------------------------------------------------------
        }
        #-------------------------------------------------------------------------------
    }
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    $StartTime = $Micro + $Seconds;
    #-------------------------------------------------------------------------------
    $Result = $Link->Query($Query);
    #-------------------------------------------------------------------------------
    list($Micro, $Seconds) = Explode(' ', MicroTime());
    #-------------------------------------------------------------------------------
    $EndTime = $Micro + $Seconds;
    #-------------------------------------------------------------------------------
    $GLOBALS['__TIME_MYSQL'] = $GLOBALS['__TIME_MYSQL'] + $EndTime - $StartTime;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    if (Is_Error($Result)) {
        return ERROR | @Trigger_Error('[DB_Query]: невозможно осуществить запрос');
    }
    #-------------------------------------------------------------------------------
    $GLOBALS['__COUNTER_MYSQL']++;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
    return $Result;
    #-------------------------------------------------------------------------------
    #-------------------------------------------------------------------------------
}
开发者ID:carriercomm,项目名称:jbs,代码行数:59,代码来源:DB.php

示例9: getPageName

 function getPageName()
 {
     $currentFile = $_SERVER["PHP_SELF"];
     $parts = Explode('/', $currentFile);
     $currentPage = $parts[count($parts) - 1];
     $pageParts = Explode('.', $currentPage);
     return $pageParts[0];
 }
开发者ID:hiroyalty,项目名称:mhealth,代码行数:8,代码来源:functions.php

示例10: TampilkanDaftarPanduan

function TampilkanDaftarPanduan()
{
    global $arrPanduan;
    echo "<p><h3>Daftar Panduan</h3></p>";
    echo "<ol>";
    for ($i = 0; $i < sizeof($arrPanduan); $i++) {
        $a = Explode('~', $arrPanduan[$i]);
        echo "<li><a href='desain/" . $a[1] . "' target=_blank>" . $a[0] . "</li>";
    }
    echo "</ol>";
}
开发者ID:anggadjava,项目名称:sisfor,代码行数:11,代码来源:diagram.php

示例11: TampilkanDaftarDiagram

function TampilkanDaftarDiagram()
{
    global $arrDiagram;
    //echo "<p><h3>SOP PENGGUNAAN SISTEM</h3></p>";
    echo "<ol>";
    for ($i = 0; $i < sizeof($arrDiagram); $i++) {
        $a = Explode('~', $arrDiagram[$i]);
        echo "<li><a href='desain/" . $a[1] . "' target=_blank>" . $a[0] . "</a>" . "</li>";
    }
    echo "</ol>";
}
开发者ID:anggadjava,项目名称:mitra_siakad,代码行数:11,代码来源:diagram.php

示例12: MasterPageCreate

 function MasterPageCreate($sender, $params)
 {
     global $LoginControl;
     $currentFile = $_SERVER['SCRIPT_NAME'];
     $parts = Explode('/', $currentFile);
     $currentFile = $parts[count($parts) - 1];
     if ($currentFile != 'Login.php') {
         if (!$LoginControl->isAuthenticated()) {
             redirect("Login.php");
         }
     }
 }
开发者ID:SkylineNando,项目名称:Delphi,代码行数:12,代码来源:MasterPage.php

示例13: where_called

 /**
  * method where_called()
  * param $level
  * return line, object and file name where the query was executed
  */
 private function where_called($level = 1)
 {
     $trace = debug_backtrace();
     $file = $trace[$level]['file'];
     $line = $trace[$level]['line'];
     $object = $trace[$level]['object'];
     if (is_object($object)) {
         $object = get_class($object);
     }
     $break = Explode('/', $file);
     $pfile = $break[count($break) - 1];
     return "Where called: line {$line} of {$object} <br/>(in {$pfile})";
 }
开发者ID:rampmaster,项目名称:XG-Proyect-v3.x.x,代码行数:18,代码来源:Debug_Lib.php

示例14: pagespecific

function pagespecific()
{
    global $language, $l_cp_tools_purgecheck;
    $currentFile = $_SERVER["SCRIPT_NAME"];
    $parts = Explode('/', $currentFile);
    $currentFile = $parts[count($parts) - 1];
    switch ($currentFile) {
        case 'edit.php':
            echo '<style type="text/css">';
            readfile('styles/system/jacs.css');
            echo '</style>' . "\n";
            echo '<script type="text/javascript" src="script/jacsLang.js"></script>' . "\n";
            echo '<script type="text/javascript" src="script/jacs.js"></script>' . "\n";
            echo '<script type="text/javascript">
		function setLanguages(jacsLanguage) {	// Set all calendars to the chosen language
		for (var i=0;i<JACS.cals().length;i++)
		{
			var jacsCal = document.getElementById(JACS.cals()[i]);

			jacsCal.language = jacsLanguage;
			jacsSetLanguage(jacsCal);

			// Refresh any static calendars so that the change shows immediately.
			if (!jacsCal.dynamic) JACS.show(jacsCal.ele,jacsCal.id,jacsCal.days);
		}
		};
		window.onload = function() {
			JACS.make("jacs",true);
			setLanguages("' . $language . '");
			if (document.getElementById("addtitle")) {
				document.getElementById("addtitle").focus();
				document.getElementById("addtitle").select();
			}
		};
		</script>' . "\n";
            break;
        case 'settings.php':
            echo '<script type="text/javascript">function check(){
				var message;
				message = confirm("' . $l_cp_tools_purgecheck . '");
				if (message) {
					this.location.href = "settings.php?delete=confirm";
				} else {
					this.location.href = "settings.php";
				}
			}</script>';
            break;
    }
}
开发者ID:btafoya,项目名称:taskstep,代码行数:49,代码来源:functions.php

示例15: getSearch

 public function getSearch()
 {
     //get keywords input for search
     $keyword = Input::get('q');
     $keywords = Explode(' ', $keyword);
     $query = DB::table('events')->leftJoin('organizations', 'organizations.id', '=', 'events.org_id');
     foreach ($keywords as $key => $value) {
         $query->orWhere('organizations.name', 'like', DB::raw("'%{$value}%'"));
         $query->orWhere('events.name', 'like', DB::raw("'%{$value}%'"));
     }
     //search that event in Database
     $events = $query->get();
     // var_dump($events);
     //return display search result to user by using a view
     return View::make('event')->with('event', $events);
 }
开发者ID:thehelpster,项目名称:helpster,代码行数:16,代码来源:SearchController.php


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