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


PHP _die函数代码示例

本文整理汇总了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 &rarr;");
        }
        _die("Edit successfull. <a href=\"" . _l("/edit/{$id}") . "\">continue editing &rarr;");
    } else {
        _die("There was an unexpected error.");
    }
}
开发者ID:shashi,项目名称:octavo,代码行数:29,代码来源:edit.php

示例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();
	}
开发者ID:rintaun,项目名称:icarus-old,代码行数:28,代码来源:Icarus.php

示例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;
 }
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:31,代码来源:db_sql.php

示例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);
 }
开发者ID:redox007,项目名称:SI_Framework,代码行数:8,代码来源:Model_defination.php

示例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;
}
开发者ID:bartcornelis,项目名称:comfortenergy,代码行数:9,代码来源:import.php

示例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);
 }
开发者ID:redox007,项目名称:SI_Framework,代码行数:10,代码来源:Model_vehical.php

示例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);
        }
    }
}
开发者ID:0unit,项目名称:online-php-ide,代码行数:55,代码来源:source.php

示例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);
	}
开发者ID:rintaun,项目名称:icarus-old,代码行数:11,代码来源:Configurator.php

示例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);
	}
开发者ID:rintaun,项目名称:icarus-old,代码行数:14,代码来源:Server.php

示例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);
	}
开发者ID:rintaun,项目名称:icarus-old,代码行数:14,代码来源:Client.php

示例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.");
    }
}
开发者ID:shashi,项目名称:octavo,代码行数:17,代码来源:delete.php

示例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));
}
开发者ID:shashi,项目名称:octavo,代码行数:21,代码来源:tags.php

示例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));
 }
开发者ID:redox007,项目名称:SI_Framework,代码行数:21,代码来源:Model_booking.php

示例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;
 }
开发者ID:NasalMusician,项目名称:Pantheum,代码行数:22,代码来源:db_php.php

示例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;
}
开发者ID:rajuthapa8086,项目名称:SimpleMVC,代码行数:26,代码来源:exceptions.php


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