本文整理汇总了PHP中_throw函数的典型用法代码示例。如果您正苦于以下问题:PHP _throw函数的具体用法?PHP _throw怎么用?PHP _throw使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_throw函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: find
/**
* find elements
*
* @param Charcoal_String|string $selector
* @param Charcoal_Integer|integer $index
*/
public function find($selector, $index = NULL)
{
Charcoal_ParamTrait::validateString(1, $selector);
Charcoal_ParamTrait::validateInteger(2, $index, TRUE);
if (!$this->simple_html_dom) {
_throw(new SimpleHtmlDomComponentException("SimpleHtmlDom object is not created"));
}
$selector = us($selector);
log_debug("debug", "index:{$index}");
if ($index !== NULL) {
// returns single element
$index = ui($index);
log_debug("debug", "returns single element");
$result = $this->simple_html_dom->find($selector, $index);
log_debug("debug", "result: " . print_r($result, true));
return $result ? new Charcoal_SimpleHtmlDomElement($result) : NULL;
}
// returns all elements
log_debug("debug", "selector:" . print_r($selector, true));
$result = $this->simple_html_dom->find($selector);
log_debug("debug", "result: " . print_r($result, true));
$elements = array();
foreach ($result as $e) {
$elements[] = new Charcoal_SimpleHtmlDomElement($e);
}
return $result ? $elements : array();
}
示例2: getTableName
/**
* Returns table name
*
* @return string
*/
public function getTableName()
{
if (!property_exists($this, '___table_name')) {
_throw(new Charcoal_TableModelException($this, s('___table_name property is not set')));
}
return $this->___table_name;
}
示例3: confirm
/**
* @param $pay_type 支付方式
* @param $month_fee 每月电费量
* @param $package_data_id 套餐id
* @param $ticket_id 绿电券id
*/
static function confirm($pay_type, $month_fee, $package_data_id, $ticket_id)
{
$ticket_price = 0;
if (empty($package_data_id)) {
_throw("请选择绿电套餐");
}
//套餐
$packageData = self::get_pkg_data($package_data_id);
if (empty($packageData)) {
_throw('未检索到绿电套餐');
}
if (empty($month_fee) || !is_numeric($month_fee)) {
_throw('请填写每月预计电费金额');
}
if ($packageData['period'] == 3) {
if ($month_fee < 200) {
$month_fee = 200;
}
} else {
if ($month_fee < C('PKG_PAGE_COMBO_NUM_INIT')) {
$month_fee = C('PKG_PAGE_COMBO_NUM_INIT');
}
}
//根据套餐配置的"是否允许使用优惠券"列来动态判断
if (!$packageData['allow_coupon']) {
$ticket_id = 0;
}
}
示例4: getPorderSaveRow
static function getPorderSaveRow($_row)
{
if (empty($_row['client_id'])) {
_throw("没有选择客户!");
}
return array("designer_uid" => empty($_row['designer_uid']) ? null : $_row['designer_uid'], "client_id" => empty($_row['client_id']) ? null : $_row['client_id'], "nutri" => empty($_row['nutri']) ? null : $_row['nutri'], "blood" => empty($_row['blood']) ? null : $_row['blood'], "parts" => empty($_row['parts']) ? null : $_row['parts'], "material" => empty($_row['material']) ? null : $_row['material'], "item" => empty($_row['item']) ? null : $_row['item'], "allergies" => empty($_row['allergies']) ? null : $_row['allergies'], "years" => empty($_row['years']) ? null : $_row['years'], "blood_pressure" => empty($_row['blood_pressure']) ? null : $_row['blood_pressure'], "medical_history" => empty($_row['medical_history']) ? null : $_row['medical_history'], "medicine" => empty($_row['medicine']) ? null : $_row['medicine'], "solution1" => empty($_row['solution1']) ? null : $_row['solution1'], "solution2" => empty($_row['solution2']) ? null : $_row['solution2'], "request" => empty($_row['request']) ? null : $_row['request']);
}
示例5: index
function index($ctx)
{
$ctx->title = '绑定微信账号';
setcookie('no_subscribe_prj', '', time() + 3600);
$user = UC::auth();
if ($user) {
$connect = WxConnect::get_by('user_id', $user['id']);
if ($connect) {
_redirect('/');
}
}
if (!$this->openid) {
if (!$_GET['redirect']) {
// 避免循环跳转
UC::logout();
// 使用域名 axelahome.com, 避免因为跨域导致 session 获取不到问题
$jump = _url('https://axelahome.com/weixin/bind', array('redirect' => 1));
$url = _url('https://axelahome.com/weixin/oauth', array('jump' => $jump));
_redirect($url);
}
_throw("链接已经过期, 请重新获取微信消息!", 200);
} else {
$connect = WxConnect::get_by('wx_openid', $this->openid);
if ($connect) {
_throw('此微信号已经绑定过懒投资账号, 请先解绑!');
}
}
}
示例6: getSaveRow
static function getSaveRow($_row)
{
if (empty($_row['client_id'])) {
_throw("没有选择客户!");
}
return array("client_id" => $_row['client_id'], "type" => empty($_row['type']) ? null : $_row['type'], "content" => empty($_row['content']) ? null : $_row['content'], "dtime" => empty($_row['dtime']) ? null : $_row['dtime'], "ndtime" => empty($_row['ndtime']) ? null : $_row['ndtime']);
}
示例7: processEvent
/**
* イベントを処理する
*/
public function processEvent($context)
{
$event = $context->getEvent();
// パラメータを取得
$app_name = $event->getAppName();
$project_name = $event->getProjectName();
$out_dir = $event->getTargetDir();
//=======================================
// Confirm input parameters
//=======================================
if (!preg_match('/^[0-9a-zA-Z_\\-]*$/', $app_name)) {
_throw(new Charcoal_InvalidArgumentException($app_name));
}
if (!preg_match('/^[0-9a-zA-Z_\\-]*$/', $project_name)) {
_throw(new Charcoal_InvalidArgumentException($project_name));
}
//=======================================
// Make output directory
//=======================================
$out_dir = new Charcoal_File($out_dir);
$out_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make web_app directory
//=======================================
$webapp_dir = new Charcoal_File('web_app', $out_dir);
$webapp_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make project directory
//=======================================
$project_dir = new Charcoal_File($project_name, $webapp_dir);
$project_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make project/app directory
//=======================================
$project_app_dir = new Charcoal_File('app', $project_dir);
$project_app_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make application directory
//=======================================
$application_dir = new Charcoal_File($app_name, $project_app_dir);
$application_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make application/class directory
//=======================================
$app_class_dir = new Charcoal_File('class', $application_dir);
$app_class_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make application/config directory
//=======================================
$app_config_dir = new Charcoal_File('config', $application_dir);
$app_config_dir->makeDirectory(self::DIR_MODE);
//=======================================
// Make application/module directory
//=======================================
$module_dir = new Charcoal_File('module', $application_dir);
$module_dir->makeDirectory(self::DIR_MODE);
echo "Application[{$app_name}] created at: " . $application_dir->getAbsolutePath() . PHP_EOL;
return b(true);
}
示例8: pop
public function pop()
{
$tail = array_pop($this->values);
if (!$tail) {
_throw(new Charcoal_StackEmptyException($this));
}
return $tail;
}
示例9: score
/**
* score
*
* @param integer $handle handle of timer
* @param integer $precision precision of timer value
*
* @return integer now score
*/
public static function score($handle, $precision = self::DEFAULT_PRECISION)
{
$start_time = isset(self::$benchmarks[$handle]) ? self::$benchmarks[$handle] : NULL;
$stop_time = microtime(true);
if ($start_time === NULL) {
_throw(new Charcoal_BenchmarkException('not started yet!'));
}
return round(($stop_time - $start_time) * 1000, $precision);
}
示例10: __construct
/**
* constructor
*/
public function __construct(Charcoal_String $url)
{
parent::__construct();
$this->original = $url;
$this->url = parse_url($url);
if ($this->url === FALSE) {
_throw(new Charcoal_URLFormatException($url));
}
}
示例11: __construct
public function __construct(Charcoal_String $address, Charcoal_String $label = NULL)
{
$this->address = $address;
$this->label = $label;
$valid = Charcoal_MailUtil::validateAddress(s($address));
if (!$valid) {
_throw(new Charcoal_InvalidMailAddressException($address));
}
}
示例12: getSaveRow
static function getSaveRow($row, $is_add = true)
{
$row = json_decode($row, 1);
if (empty($row['dep_name'])) {
_throw("部门名不能为空");
}
$_row = array("dep_name" => empty($row['dep_name']) ? null : $row['dep_name'], "dep_pid" => empty($row['dep_pid']) ? 1 : $row['dep_pid']);
return array("row" => $_row);
}
示例13: getSaveRow
static function getSaveRow()
{
$row = Utils::I("row");
$row = json_decode($row, 1);
if (empty($row['title'])) {
_throw("title不能为空");
}
$_row = array("title" => empty($row['title']) ? "" : $row['title'], "pics" => empty($row['pics']) ? "" : $row['pics'], "name" => empty($row['name']) ? "" : $row['name']);
return $_row;
}
示例14: getSaveRow
static function getSaveRow($_row)
{
if (empty($_row['com_name'])) {
_throw("企业名不能为空!");
}
if (empty($_row['province_id'])) {
_throw("所属省份不能为空!");
}
return array("com_name" => empty($_row['com_name']) ? null : $_row['com_name'], "com_charger" => empty($_row['com_charger']) ? null : $_row['com_charger'], "tel" => empty($_row['tel']) ? null : $_row['tel'], "sex" => empty($_row['sex']) ? 0 : 1, "addr" => empty($_row['addr']) ? null : $_row['addr'], "area_id" => empty($_row['area_id']) ? null : $_row['area_id'], "province_id" => empty($_row['province_id']) ? null : $_row['province_id'], "zxs_uid" => intval(empty($_row['zxs_uid']) ? null : $_row['zxs_uid']), "zxz_uid" => intval(empty($_row['zxz_uid']) ? null : $_row['zxz_uid']), "kf_uid" => intval(empty($_row['kf_uid']) ? null : $_row['kf_uid']));
}
示例15: __construct
public function __construct($class_name)
{
// Charcoal_ParamTrait::validateString( 1, $class_name );
$class_name = us($class_name);
parent::__construct();
if (!class_exists($class_name)) {
_throw(new Charcoal_ClassNotFoundException($class_name));
}
$this->class_name = us($class_name);
}