當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。