本文整理匯總了PHP中Define函數的典型用法代碼示例。如果您正苦於以下問題:PHP Define函數的具體用法?PHP Define怎麽用?PHP Define使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Define函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: session
/**
* Creating new session
*
*
*
* @param string Session name
* @access public
*/
function session($name)
{
$this->name = $name;
ini_set('session.use_only_cookies', '1');
if (!isset($_SERVER['HTTP_USER_AGENT']) || $this->checkBot($_SERVER['HTTP_USER_AGENT'])) {
session_set_cookie_params(0);
// current browser session only
session_name($name);
@session_start();
// setting expiration time for session (the easiest way)
$expiretime = 60 * 60 * 1;
// 2 hours
if (isset($_SESSION['expire']) && $_SESSION['expire'] < time()) {
$_SESSION['DATA'] = '';
}
$_SESSION['expire'] = time() + $expiretime;
if (isset($_SESSION['DATA'])) {
$this->data = unserialize($_SESSION['DATA']);
} else {
$this->data = array();
}
$this->started = 1;
Define("SESSION_ID", session_name() . "=" . session_id());
Define("SID", session_name() . "=" . session_id());
}
}
示例2: setSection
public function setSection($section)
{
if ($section == "admin") {
Define('USE_DIR', DIR_APPLICATION);
$this->data['section'] = $this->language->get('menu_backend');
return "§ion=admin";
} else {
Define('USE_DIR', DIR_ROOT);
$this->data['section'] = $this->language->get('menu_frontend');
return "";
}
}
示例3: setup_import
function setup_import()
{
Define("HOST_ADDR", "localhost");
// if the database cluster is on the same server as this application use 'localhost' otherwise the appropriate address (192.168.0.2 for example).
Define("PORT_NO", "5432");
// default port is 5432. If you have or had more than one db cluster at the same time, consider ports 5433,... etc.
Define("DATABASE_NAME", "testdb");
// the database you want to import
Define("USER_NAME", "username");
// role having rights to read the database
Define("PASSWORD", "??????");
// password for role
}
示例4: Prepare
public static function Prepare($config)
{
Define('DS', DIRECTORY_SEPARATOR);
Define('FRAMEWORK_DIR', dirname(dirname(__FILE__)) . "/cherryphp");
Define('APP_DIR', dirname(dirname(__FILE__)));
spl_autoload_register(array('Cherry', 'LoadClass'));
Init::$Router = (require APP_DIR . DS . 'router.php');
if (!empty($config)) {
Init::$Config = (require $config . "config.php");
} else {
Init::$Config = (require APP_DIR . DS . 'config.php');
}
foreach (Init::$Config['define'] as $k => $v) {
Define($k, Init::$Config['define'][$k]);
}
#spl_autoload_register(array('Cherry','appClass'));
return new self();
}
示例5: session_start
<?php
session_start();
$_POST = json_decode(file_get_contents("php://input"), true);
if (isset($_SESSION['net_id'])) {
include "advanced_user_oo.php";
Define('DATABASE_SERVER', $hostname);
Define('DATABASE_USERNAME', $username);
Define('DATABASE_PASSWORD', $password);
Define('DATABASE_NAME', 'event_manager');
class DbInfo
{
var $res = false;
var $delete_res = '';
}
$mysqli = new mysqli(DATABASE_SERVER, DATABASE_USERNAME, DATABASE_PASSWORD, DATABASE_NAME);
$db_info = new DbInfo();
$event_id = $_POST['event_id'];
$room_id = $_POST['room_id'];
if (empty($_POST['session_start'])) {
$session_start = null;
} else {
$session_start = $_POST['session_start'];
}
if (empty($_POST['session_end'])) {
$session_end = null;
} else {
$session_end = $_POST['session_end'];
}
$net_id = $_POST['net_id'];
$waiter_id = $_POST['waiter_id'];
示例6: Define
<?php
/**
* Libraries loader
*
* Used to load required libraries
*
* @author Serge Dzheigalo <jey@activeunit.com>
* @package framework
* @copyright ActiveUnit, Inc. 2001-2004
* @version 1.0
* @modified 01-Jan-2004
*/
Define("THIS_URL", $_SERVER['REQUEST_URI']);
// liblary modules loader
if ($lib_dir = @opendir("./lib")) {
while (($lib_file = readdir($lib_dir)) !== false) {
if (preg_match("/\\.php\$/", $lib_file) && $lib_file != "loader.php") {
include_once "./lib/{$lib_file}";
}
}
closedir($lib_dir);
}
// Insert the path where you unpacked log4php
require_once dirname(__FILE__) . '/log4php/Logger.php';
// Tell log4php to use our configuration file.
Logger::configure(dirname(__FILE__) . '/log4php/config.php');
示例7: Define
/**
* vcard.php
*
* This file shows an attched vcard
*
* @copyright © 1999-2007 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id: vcard.php 12127 2007-01-13 20:07:24Z kink $
* @package squirrelmail
*/
/**
* Path for SquirrelMail required files.
* @ignore
*/
Define('SM_PATH', '../');
/* SquirrelMail required files. */
require_once SM_PATH . 'include/validate.php';
require_once SM_PATH . 'functions/date.php';
require_once SM_PATH . 'functions/page_header.php';
require_once SM_PATH . 'functions/mime.php';
require_once SM_PATH . 'include/load_prefs.php';
/* globals */
sqgetGlobalVar('username', $username, SQ_SESSION);
sqgetGlobalVar('key', $key, SQ_COOKIE);
sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('passed_id', $passed_id, SQ_GET);
sqgetGlobalVar('mailbox', $mailbox, SQ_GET);
sqgetGlobalVar('ent_id', $ent_id, SQ_GET);
sqgetGlobalVar('startMessage', $startMessage, SQ_GET);
/* end globals */
示例8: Define
<?php
/*
* @version 0.1 (auto-set)
*/
Define('IWIDTH', 120);
Define('IHEIGHT', 20);
Define('TEXTLENGTH', 5);
Define('FROMFILE', './lib/codebook.txt');
Define('FONT', './lib/_vimage_tahoma.ttf');
include_once "./lib/general.class.php";
if (!defined('ENVIRONMENT')) {
error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);
ini_set('display_errors', 0);
}
$position = (int) $_GET['n'];
$file = fopen(FROMFILE, "r");
$content = fread($file, filesize(FROMFILE));
fclose($file);
while ($position > strlen($content)) {
$position -= strlen($content);
}
$text = substr($content, $position, 3 * TEXTLENGTH);
$text = preg_replace("/[^a-zA-Z0-9]+/", '', $text);
$text = substr($text, 0, TEXTLENGTH);
$text = strtolower($text);
header("Content-type: image/png");
$im = ImageCreate(IWIDTH, IHEIGHT);
if ($im === false) {
die("Cannot Initialize new GD image stream");
}
示例9: Define
<?php
Define("pageLoaderConfFile", "{$settings['moduleAddress']}/{$sysVar['op']}/config/config");
$config = pageLoaderConfFile . ".php";
if (file_exists($config)) {
require_once $config;
} else {
die("Page Loader sub system is down !");
}
示例10: Define
} else {
// default to agipa 119601, first format implemented
Define("PAPER_SIZE", "A4");
Define("PAPER_ORIENTATION", "P");
Define("V_MARGIN", 6);
Define("H_MARGIN", 13);
Define("COL_SIZE", 22);
Define("ROW_SIZE", 16);
Define("COL_NUM", 9);
Define("ROW_NUM", 17);
Define("V_PADDING", 0);
Define("H_PADDING", 0);
Define("BARCODE_WIDTH", 20);
Define("BARCODE_HEIGHT", 10);
Define("TEXT_HEIGHT", 3);
Define("TEXT_SIZE", 8);
}
require_once \Pasteque\PT::$ABSPATH . "/lib/barcode-master/php-barcode.php";
$font = "./lib/barcode-master/NOTTB___.TTF";
$pdf = new \FPDF(PAPER_ORIENTATION, "mm", PAPER_SIZE);
$pdf->setMargins(H_MARGIN, V_MARGIN);
$pdf->setAutoPageBreak(false, V_MARGIN);
$pdf->AddPage();
$pdf->SetFont('Arial', 'B', TEXT_SIZE);
function pdf_barcode($pdf, $productId, $col, $row)
{
$product = \Pasteque\ProductsService::get($productId);
$x = H_MARGIN + $col * COL_SIZE + $col * H_PADDING;
$y = V_MARGIN + $row * ROW_SIZE + $row * V_PADDING;
$pdf->SetXY($x, $y);
$pdf->Cell(BARCODE_WIDTH, TEXT_HEIGHT, utf8_decode($product->reference), 0, 1, "C");
示例11: define
define('FILENAME_ORDERS_INVOICE', 'invoice.php');
define('FILENAME_ORDERS_PACKINGSLIP', 'packingslip.php');
define('FILENAME_ORDERS_STATUS', 'orders_status.php');
define('FILENAME_PAGES', 'pages.php');
define('FILENAME_POPUP_FILE_MANAGER', 'popup_file_manager.php');
define('FILENAME_POPUP_FORBIDDEN', 'popup_forbidden.php');
define('FILENAME_POPUP_IMAGE', 'popup_image.php');
define('FILENAME_POPUP_INFO_PAGES', 'popup_info_pages.php');
define('FILENAME_POPUP_PAGES', 'popup_pages.php');
define('FILENAME_PRODUCTS_ATTRIBUTES', 'products_attributes.php');
define('FILENAME_PRODUCTS_EXPECTED', 'products_expected.php');
define('FILENAME_REVIEWS', 'reviews.php');
define('FILENAME_SERVER_INFO', 'server_info.php');
define('FILENAME_SHIPPING_MODULES', 'shipping_modules.php');
define('FILENAME_STATS_CREDITS', 'stats_credits.php');
define('FILENAME_STATS_CUSTOMERS', 'stats_customers.php');
define('FILENAME_STATS_PRODUCTS_PURCHASED', 'stats_products_purchased.php');
define('FILENAME_STATS_PRODUCTS_VIEWED', 'stats_products_viewed.php');
define('FILENAME_TAX_CLASSES', 'tax_classes.php');
define('FILENAME_TAX_RATES', 'tax_rates.php');
define('FILENAME_WHOS_ONLINE', 'whos_online.php');
define('FILENAME_XSELL_PRODUCTS', 'xsell.php');
define('FILENAME_ZONES', 'zones.php');
define('FILENAME_ADMIN_ACCOUNT', 'admin_account.php');
define('FILENAME_ADMIN_MEMBERS', 'admin_members.php');
Define('FILENAME_FORBIDDEN', 'forbidden.php');
define('FILENAME_LOGIN', 'login.php');
define('FILENAME_LOGOFF', 'logoff.php');
define('FILENAME_PASSWORD_FORGOTTEN', 'password_forgotten.php');
define('FILENAME_UPDATE_PRODUCTS_PRICES', 'update_products_prices.php');
$linkable_files = array('account.php' => 'SSL', 'account_edit.php' => 'SSL', 'account_history.php' => 'SSL', 'account_history_info.php' => 'SSL', 'account_newsletters.php' => 'SSL', 'account_notifications.php' => 'SSL', 'account_password.php' => 'SSL', 'address_book.php' => 'SSL', 'address_book_process.php' => 'SSL', 'advanced_search_and_results.php' => 'NONSSL', 'checkout_confirmation.php' => 'SSL', 'checkout_payment.php' => 'SSL', 'checkout_payment_address.php' => 'SSL', 'checkout_process.php' => 'SSL', 'checkout_shipping.php' => 'SSL', 'checkout_shipping_address.php' => 'SSL', 'checkout_success.php' => 'SSL', 'content.php' => 'NONSSL', 'cookie_usage.php' => 'NONSSL', 'create_account.php' => 'SSL', 'create_account_success.php' => 'SSL', 'index.php' => 'NONSSL', 'images_window.php' => 'NONSSL', 'login.php' => 'SSL', 'logoff.php' => 'SSL', 'newsletter_subscribe.php' => 'SSL', 'options_window.php' => 'NONSSL', 'password_forgotten.php' => 'SSL', 'popup_content.php' => 'REQUEST_TYPE', 'popup_image.php' => 'REQUEST_TYPE', 'product_info.php' => 'NONSSL', 'product_listing.php' => 'NONSSL', 'product_reviews.php' => 'NONSSL', 'product_reviews_info.php' => 'NONSSL', 'product_reviews_write.php' => 'SSL', 'products_new.php' => 'NONSSL', 'reviews.php' => 'NONSSL', 'search_result.php' => 'NONSSL', 'shopping_cart.php' => 'NONSSL', 'specials.php' => 'NONSSL', 'ssl_check.php' => 'NONSSL', 'tell_a_friend.php' => 'SSL');
示例12: Define
Define('InvalidStartDate', 1142);
Define('InvalidCostIssued', 1143);
Define('InvalidQuantityRequired', 1144);
Define('InvalidQuantityReceived', 1145);
Define('InvalidStandardCost', 1146);
Define('IncorrectSerialNumber', 1147);
Define('WorkOrderDoesntExist', 1148);
Define('InvalidIssuedQuantity', 1149);
Define('InvalidTransactionDate', 1150);
Define('InvalidReceivedQuantity', 1151);
Define('ItemNotControlled', 1152);
Define('ItemSerialised', 1153);
Define('BatchNumberDoesntExist', 1154);
Define('BatchIsEmpty', 1155);
Define('NoSuchArea', 1156);
Define('NoSuchSalesMan', 1157);
/* Array of Descriptions of errors */
$ErrorDescription['1'] = _('No Authorisation');
$ErrorDescription['1000'] = _('Incorrect Debtor Number Length');
$ErrorDescription['1001'] = _('Debtor No Already Exists');
$ErrorDescription['1002'] = _('Incorrect Debtor Name Length');
$ErrorDescription['1003'] = _('Invalid Address Line');
$ErrorDescription['1004'] = _('Currency Code Not Setup');
$ErrorDescription['1005'] = _('Sales Type Not Setup');
$ErrorDescription['1006'] = _('Invalid Client Since Date');
$ErrorDescription['1007'] = _('Hold Reason Not Setup');
$ErrorDescription['1008'] = _('Payment Terms Not Setup');
$ErrorDescription['1009'] = _('Invalid Discount');
$ErrorDescription['1010'] = _('Invalid Payment Discount');
$ErrorDescription['1011'] = _('Invalid Last Paid');
$ErrorDescription['1012'] = _('Invalid Last Paid Date');
示例13: Define
* @since 20-Jan-2004
* @version 2.4
*/
/**
* Used for building query string
*/
Define("PARAMS_DELIMITER", "pz_");
/**
* Used for building query string
*/
Define("STRING_DELIMITER", "sz_");
/**
* Used for building query string
*/
Define("EQ_DELIMITER", "qz_");
/**
* Framework Module Class
*
* Used by all modules to work correctly in project framework
*
* @package framework
* @author Serge Dzheigalo
* @copyright http://www.activeunit.com/ (c) 2002
* @version 1.0b
*/
class module {
/**
* @var string module name
*/
示例14: Define
<?php
/**
* ����������
*
* Saverestore
*
* @package MajorDoMo
* @author Serge Dzheigalo <jey@tut.by> http://smartliving.ru/
* @version 0.6 (2010-08-30) WINDOWS ONLY!
*/
//
//
Define('UPDATER_URL', 'http://updates.au78.com/updates/');
class saverestore extends module
{
/**
* saverestore
*
* Module class constructor
*
* @access private
*/
function saverestore()
{
$this->name = "saverestore";
$this->title = "<#LANG_MODULE_SAVERESTORE#>";
$this->module_category = "<#LANG_SECTION_SYSTEM#>";
$this->checkInstalled();
}
/**
示例15: Define
<?php
/**
* Main project script
*
* @package MajorDoMo
* @author Serge Dzheigalo <jey@tut.by> http://smartliving.ru/
* @version 1.1
*/
Define('BTRACED', 1);
// Get the received data from the iPhone (XML data)
$body = @file_get_contents('php://input');
// Try to load the XML
$xml = simplexml_load_string($body);
// If there was an error report it...
if ($xml == false) {
// Error loading XML..., send it back to the iPhone
echo '{ "id":902, "error":true, "message":"Cant load XML", "valid":true }';
exit;
} else {
// Get username and password
$username = $xml->username;
$password = $xml->password;
// Optional: You can check the username and password against your database
// Uncomment for hardcoded testing
// if (($username != 'user') && ($password != 'test'))
// {
// echo '{ "id":1, "error":true, "valid":true }';
// exit();
// }
// Get device identification