本文整理汇总了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];
}
示例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;
}
示例3: current_pagename
function current_pagename()
{
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
$mypage = $parts[count($parts) - 1];
return $mypage;
}
示例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');
}
示例5: scriptname
function scriptname()
{
$file = $_SERVER["SCRIPT_NAME"];
$break = Explode('/', $file);
$pfile = $break[count($break) - 1];
return $pfile;
}
示例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);
}
示例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;
}
示例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;
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
}
示例9: getPageName
function getPageName()
{
$currentFile = $_SERVER["PHP_SELF"];
$parts = Explode('/', $currentFile);
$currentPage = $parts[count($parts) - 1];
$pageParts = Explode('.', $currentPage);
return $pageParts[0];
}
示例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>";
}
示例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>";
}
示例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");
}
}
}
示例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})";
}
示例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;
}
}
示例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);
}