本文整理汇总了PHP中_die函数的典型用法代码示例。如果您正苦于以下问题:PHP _die函数的具体用法?PHP _die怎么用?PHP _die使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_die函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edit_note
function edit_note($id)
{
if ((string) (int) $id != $id) {
_die("Invalid ID");
}
include "lib/tags.php";
$post_data =& $_POST;
foreach (array('ID', 'title', 'contents', 'tags', 'time', 'slug') as $key) {
$post_data[$key] = pg_escape_string(@$post_data[$key]);
}
$post_data['tags'] = clean_tags($post_data['tags']);
if (trim($post_data['slug']) == '') {
$post_data['slug'] = make_slug($post_data['title']);
}
if (!($time = strtotime(@$post_data['time']))) {
$time = date("Y-m-d H:i:s O", time());
} else {
$time = date("Y-m-d H:i:s O", $time);
}
$result = db("UPDATE public.\"notes\" SET \"title\" = '{$post_data['title']}',\n\t\t\t\"contents\" ='{$post_data['contents']}', \"tags\" = '{$post_data['tags']}',\n\t\t\t\"slug\" ='{$post_data['slug']}'\n\t\t\tWHERE \"ID\" = " . pg_escape_string($id));
if ($result) {
if (!rebuild_tags()) {
_die("There was an error rebuilding the tag cloud data.\n\t\t\t\t<a href=\"" . _l("/edit/{$id}") . "\">Go back →");
}
_die("Edit successfull. <a href=\"" . _l("/edit/{$id}") . "\">continue editing →");
} else {
_die("There was an unexpected error.");
}
}
示例2: start
public function start()
{
$c = Configurator::getInstance();
$l = Logger::getInstance();
if (isset($c->config['logfile']))
$l->setLogfile($c->config['logfile']);
if ((!isset($c->config['debugmode'])) || ($c->config['debugmode'] == "false"))
$l->debug(FALSE);
elseif (is_numeric($c->config['debugmode']))
$l->debug($c->config['debugmode']);
elseif ($c->config['debugmode'] == "true")
$l->debug(3);
else
$l->debug(FALSE);
if (isset($c->config['die']))
_die("Icarus: read the config file!");
$this->loadClients();
$this->loadServers();
$this->running = TRUE;
$SH = SocketHandler::getInstance();
$SH->loop();
}
示例3: find_all_words
function find_all_words($name = NULL, $lang = NULL, $spart = NULL)
{
global $sql_stmts;
$stmt = [];
$params = [""];
if ($name !== NULL) {
$stmt[] = "word_name";
$params[0] .= "s";
$params[] = $name;
}
if ($lang !== NULL) {
$stmt[] = "word_lang";
$params[0] .= "s";
$params[] = $lang;
}
if ($spart !== NULL) {
$stmt[] = "word_spart";
$params[0] .= "s";
$params[] = $spart;
}
if (!count($stmt)) {
_die("bad arguments: need one non-NULL");
}
$stmt = $sql_stmts["word_id<-" . implode(",", $stmt)];
$res = NULL;
sql_getmany(sql_prepare($stmt), $res, $params);
foreach ($res as &$r) {
$r = WORD($this, $r);
}
return $res;
}
示例4: register_place
public function register_place($data, $type = '')
{
$table = $this->get_table_name($type);
if ($this->setTable($table)->setWhereGroup($data)->get_results()) {
_die("This data already exists.");
}
return $this->insertRecord($table, $data);
}
示例5: importo_save_node
function importo_save_node($node)
{
$node = node_submit($node);
if (!$node) {
_die("FATAL [" . __FILE__ . " (" . __LINE__ . ")]: node_submit failed");
}
node_save($node);
return $node;
}
示例6: assign
public function assign($driver_id, $vehical_id, $data = array())
{
if ($this->setTable(TBL_DRIVER_VEHICALS)->setWhereStringArray(array("( driver_id = '{$driver_id}' AND is_current = '1' )", "( vehical_id = '{$vehical_id}' AND is_current = '1' )"), "OR")->execute()->result()) {
_die("The driver or vehical may be engage.");
}
if (!$data) {
return false;
}
return $this->insertRecord(TBL_DRIVER_VEHICALS, $data);
}
示例7: add_directory_to_zip
function add_directory_to_zip(&$z, $dir, $base_dir = NULL)
{
global $exclude_files, $exclude_dirs;
if (empty($z)) {
_die('Error in ZIP Parameter');
}
if (is_null($base_dir)) {
$base_dir = trim($dir, '/');
$base_dir = trim($base_dir, '\\');
}
if (!file_exists($dir)) {
_log('dir: ' . $dir . ' does not exist');
return;
}
foreach (scandir($dir) as $file) {
if (in_array($file, array('.', '..'))) {
continue;
}
// check the exclude dirs
$continue = false;
if (!empty($exclude_dirs)) {
foreach ($exclude_dirs as $e_dir) {
if (preg_match($e_dir, $dir . DIRECTORY_SEPARATOR . $file)) {
$continue = true;
}
}
}
if ($continue) {
continue;
}
// check the exclude files
$continue = false;
if (!empty($exclude_files)) {
foreach ($exclude_files as $e_file) {
if (preg_match($e_file, $dir . DIRECTORY_SEPARATOR . $file)) {
$continue = true;
}
}
}
if ($continue) {
continue;
}
if (is_dir($dir . DIRECTORY_SEPARATOR . $file)) {
// add
add_directory_to_zip($z, $dir . DIRECTORY_SEPARATOR . $file, $base_dir);
} elseif (is_readable($dir . DIRECTORY_SEPARATOR . $file)) {
// directory for the ZIP file
$zDir = str_replace($base_dir, '', $dir);
$zDir = trim($zDir, '/');
$zDir = trim($zDir, '\\');
$zDir .= empty($zDir) ? '' : '/';
$z->addFile($dir . DIRECTORY_SEPARATOR . $file, $zDir . $file);
}
}
}
示例8: _create
protected function _create($filename = NULL)
{
$logger = Logger::getInstance(NULL);
if (!is_null($filename)) $this->configfile = $filename;
else $this->configfile = $GLOBALS['etcdir'] . 'icarus.conf';
if (!file_exists($this->configfile)) _die("Fatal Error: Configuration file (%s) not found.", $this->configfile);
$this->config = $this->parse($this->configfile);
}
示例9: __construct
final public function __construct($name, $config)
{
$this->config = $config;
if ((!isset($config['listen'])) || (!isset($config['port'])))
_die("Server %s: Didn't get a listening address or port value!", $name);
$SH = SocketHandler::getInstance();
// $this->sid = $SH->createListener(etc. etc. etc.)
$this->loadModules();
$this->_create($name, $config);
}
示例10: __construct
final public function __construct($name, $config)
{
$this->config = $config;
if ((!isset($config['server'])) || (!isset($config['port'])))
_die("Client %s: Didnt get a server or port value!", $name);
$SH = SocketHandler::getInstance();
$this->sid = $SH->createSocket($config['server'], $config['port'], $this);
$this->loadModules();
$this->_create($name, $config);
}
示例11: delete_note
function delete_note($id)
{
if ((string) (int) $id != $id) {
_die("Invalid ID");
}
require_once "lib/tags.php";
$result = db("DELETE FROM public.\"notes\" WHERE \"ID\" = " . pg_escape_string($id));
if ($result) {
if (rebuild_tags()) {
_die("Note was purged successfully.");
} else {
_die("There was an error building the tag cloud data. Please run make_tags.php to fix this.");
}
} else {
_die("There was an unexpected error.");
}
}
示例12: delete_tags
function delete_tags($id)
{
$tags = db("SELECT tags from public.notes WHERE \"ID\"=" . pg_escape_string($id));
if (pg_num_rows($tags) == 0) {
_die("Does not exists.", "404");
}
$row = pg_fetch_assoc($tags);
$tags = trim($row['tags']);
$tags = explode(' ', $tags);
$tags_data = unserialize(file_get_contents("ser/tags.ser"));
foreach ($tags as $tag) {
$tags_data['tags'][$tag] -= 1;
if ($tags_data['tags'][$tag] == 0) {
unset($tags_data['tags'][$tag]);
}
}
$tags_data['max'] = max($tags_data);
$tags_data['min'] = min($tags_data);
$tags_data['total'] = array_sum($tags_data);
file_put_contents("ser/tags.ser", serialize($tags_data));
}
示例13: cancel_booking
public function cancel_booking($booking_no, $passenger_id)
{
$booking = $this->get_booking(array('id' => $booking_no, 'passenger_id' => $passenger_id));
if (!$booking) {
_die("The booking does not belongs to you.");
}
if ($booking['booking_status'] == BOOKING_COMPLETED) {
_die("Sorry! the order is already completed. You can't cancel.");
}
$orders = $this->get_booking_orders($booking_no, array('order_status'));
if ($orders) {
foreach ($orders as $order) {
if ($order['order_status'] == ORDER_ARRIVED or $order['order_status'] == ORDER_STARTED) {
_die("Sorry! the truck already arrived or started. You can't cancel.");
}
}
}
$this->updateRecord(TBL_BOOKING, array('id' => $booking_no), array('booking_status' => BOOKING_CANCELLED));
$this->updateRecord(TBL_ORDERS, array('booking_no' => $booking_no), array('order_status' => ORDER_CANCELLED));
$this->updateRecord(TBL_ORDERS_TRACKING, array('booking_no' => $booking_no), array('tracking_status' => 2));
}
示例14: find_all_words
function find_all_words($name = NULL, $lang = NULL, $id = NULL)
{
if ($id !== NULL) {
return [$this->_data[$id]];
}
if ($name === NULL) {
_die("need name");
}
$res = [];
foreach ($this->_data as &$word) {
if ($lang !== NULL and $word->lang() !== $lang) {
continue;
} else {
if ($name !== NULL and $word->name() !== $name) {
continue;
} else {
$res[] =& $word;
}
}
}
return $res;
}
示例15: myErrorHandler
/**
* Function error_handler
*/
function myErrorHandler($errno, $errstr, $errfile, $errline)
{
if (!(error_reporting() & $errno)) {
return;
}
switch ($errno) {
case E_USER_ERROR:
_die("Error Occured!", sprintf("<p><strong>Fatal Error: </strong>[{$errno}] {$errstr}.</p>" . "<p><strong>Line Number: {$errline}</p>" . "<p><strong>File Name: {$errfile}</p>"));
break;
case E_USER_WARNING:
_die("Warning!", sprintf("<p><strong>Warning: </strong>[{$errno}] {$errstr}.</p>" . "<p><strong>Line Number: {$errline}</p>" . "<p><strong>File Name: {$errfile}</p>"), false);
break;
case E_USER_NOTICE:
echo "<b>My NOTICE</b> [{$errno}] {$errstr}<br />\n";
_die("Notice!", sprintf("<p><strong>Notice: </strong>[{$errno}] {$errstr}.</p>" . "<p><strong>Line Number: {$errline}</p>" . "<p><strong>File Name: {$errfile}</p>"), false);
break;
default:
_die("Error!", sprintf("<p><strong>Error: </strong>[{$errno}] {$errstr}.</p>" . "<p><strong>Line Number: {$errline}</p>" . "<p><strong>File Name: {$errfile}</p>"));
break;
}
/* Don't execute PHP internal error handler */
return false;
}