本文整理汇总了PHP中E函数的典型用法代码示例。如果您正苦于以下问题:PHP E函数的具体用法?PHP E怎么用?PHP E使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了E函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$a = $_GET['a'];
if (empty($a)) {
E('参数错误');
}
}
示例2: connect
/**
* 连接数据库方法
* @access public
*/
public function connect($config = '', $linkNum = 0)
{
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) {
$config = $this->config;
}
$pconnect = !empty($config['params']['persist']) ? $config['params']['persist'] : $this->pconnect;
$conn = $pconnect ? 'pg_pconnect' : 'pg_connect';
$this->linkID[$linkNum] = $conn('host=' . $config['hostname'] . ' port=' . $config['hostport'] . ' dbname=' . $config['database'] . ' user=' . $config['username'] . ' password=' . $config['password']);
if (0 !== pg_connection_status($this->linkID[$linkNum])) {
E($this->error(false));
}
//设置编码
pg_set_client_encoding($this->linkID[$linkNum], $config['charset']);
//$pgInfo = pg_version($this->linkID[$linkNum]);
//$dbVersion = $pgInfo['server'];
// 标记连接成功
$this->connected = true;
//注销数据库安全信息
if (1 != C('DB_DEPLOY_TYPE')) {
unset($this->config);
}
}
return $this->linkID[$linkNum];
}
示例3: check
public function check()
{
if (!$this->config['email'] || !$this->config['key'] || !$this->config['partner']) {
E("支付宝设置有误!");
}
return true;
}
示例4: index
public function index()
{
try {
//获取文章信息
$article_id = I("get.article_id");
if (!$article_id) {
E("编号丢失");
}
$model_article = D("WxArticle");
$info = $model_article->where("id = {$article_id}")->find();
//初始化jssdk信息
import("Think.WX.jssdk");
$this->jssdk = new \JSSDK($this->getAppid(), $this->getAppsecret());
$signPackage = $this->jssdk->GetSignPackage();
//关注连接
$subscribe_url = $this->model_config->val("subscribe_url");
$web = $this->model_config->val("web");
$this->assign("info", $info);
$this->assign("subscribe_url", $subscribe_url);
$this->assign("signPackage", $signPackage);
$this->assign("uid", $this->user['uid']);
$this->assign("web", $web);
$this->display("index");
} catch (\Exception $e) {
$this->layer_alert($e->getMessage());
}
}
示例5: login
public function login()
{
if (!IS_POST) {
E('无效的页面');
}
$Verify = new \Think\Verify();
//if(!$Verify->check($code)) $this->error('验证码错误');
$db = M('login');
$user = $db->where(array('username' => I('username')))->find();
if (!$user || $user['password'] != I('password', '', md5)) {
$this->error('账号或密码错误');
}
//更新最后一次登录时间及IP
$data = array('id' => $user['id'], 'logintime' => time(), 'loginip' => get_client_ip());
$db->save($data);
session('uid', $user['id']);
session('username', $user['username']);
session('name', $user['name']);
session('logintime', date('Y-m-d H:i:s', $user['logintime']));
session('loginip', $user['loginip']);
if ($user['jd'] == '1') {
session('admin', '1');
} else {
session('admin', '0');
}
if (I('username') == 'admin') {
session('iadmin', 1);
} else {
session('iadmin', 0);
}
$this->redirect('/Home/Index/index');
}
示例6: create_product_template
public function create_product_template()
{
$name = I('post.name');
$code = I('post.code');
$price = I('post.price', 0);
$category = I('post.category');
$type = I('post.type', 'product');
$attributes = I('post.attributes/a');
$description = I('post.description');
//判断传进来的参数格式的正确性
if (empty($product_template_name) || empty($product_template_category) || empty($default_code)) {
E(201, 'parameters error');
}
//拼装路径
$parent_path = substr($product_template_category, strrpos($product_template_category, ',') + 1);
$product_template_category = substr($product_template_category, 0, strrpos($product_template_category, ','));
//判断相对应的分类是否存在
$category_array = explode(",", $product_template_category);
//获得最后一级分类的id号
$category_id = $this->modoo_category->create_category_by_path($parent_path, $product_template_category);
//查看对应的属性值是否存在
$attributes = $this->modoo_product_attribute->attribute_name_value_isset($attributes, false);
//创建产品模版,并返回该产品模版的编号
$product_template_infomation = $this->modoo_product_template->create_product_template($product_template_name, $type, $description, $price, $attributes, $category_id, $default_code);
//判断是否创建成功
if (is_numeric($product_template_infomation)) {
E(0, 'create product template sucess', array('id' => $product_template_infomation));
} else {
E(401, 'create product template error', array('message' => $product_template_infomation));
}
}
示例7: connect
/**
* 连接数据库方法
* @access public
* @throws ThinkExecption
*/
public function connect($config = '', $linkNum = 0)
{
if (!isset($this->linkID[$linkNum])) {
if (empty($config)) {
$config = $this->config;
}
$this->linkID[$linkNum] = new \mysqli($config['hostname'], $config['username'], $config['password'], $config['database'], $config['hostport'] ? intval($config['hostport']) : 3306);
if (mysqli_connect_errno()) {
E(mysqli_connect_error());
}
$dbVersion = $this->linkID[$linkNum]->server_version;
// 设置数据库编码
$this->linkID[$linkNum]->query("SET NAMES '" . $config['charset'] . "'");
//设置 sql_model
if ($dbVersion > '5.0.1') {
$this->linkID[$linkNum]->query("SET sql_mode=''");
}
// 标记连接成功
$this->connected = true;
//注销数据库安全信息
if (1 != C('DB_DEPLOY_TYPE')) {
unset($this->config);
}
}
return $this->linkID[$linkNum];
}
示例8: setDriver
/**
* 设置支付驱动
* @param string $class 驱动类名称
*/
private function setDriver($class, $config)
{
$this->payer = new $class($config);
if (!$this->payer) {
E("不存在支付驱动:{$class}");
}
}
示例9: connect
/**
* 连接会员系统
* @param type $name 服务名
* @param type $options 参数
* @return \Libs\Service\class
*/
public static function connect($name = '', $options = array())
{
if (false == isModuleInstall('Member')) {
return new Passport($options);
}
if (empty($options['type'])) {
//网站配置
$config = cache("Member_Config");
if ($config['interface']) {
$type = $config['interface'];
} else {
$type = 'Local';
}
} else {
$type = $options['type'];
}
//附件存储方案
$class = strpos($type, '\\') ? $type : 'Libs\\Driver\\Passport\\' . ucwords(strtolower($type));
if (class_exists($class)) {
$connect = new $class($options);
} else {
E("通行证驱动 {$class} 不存在!");
}
return $connect;
}
示例10: setData
/**
* @copydoc ExtendedSaver::setData
*/
public function setData(Data $data)
{
parent::setData($data);
if (!$data->getFieldByName('news_segment')->getRowData(0)) {
$f = new Field('news_segment');
$translitedTitle = Translit::asURLSegment($data->getFieldByName('news_title')->getRowData(0));
$filter = array();
$pkF = $this->getData()->getFieldByName($this->getPK());
if ($pkF = $pkF->getRowData(0)) {
$filter[$this->getPK()] = $pkF;
}
for ($i = 0; $i < 30; $i++) {
$tempTitle = $translitedTitle;
if ($i) {
$tempTitle = $translitedTitle . '-' . $i;
}
$filter = array('news_segment' => $tempTitle);
if (!$this->dbh->getScalar($this->getTableName(), 'news_segment', $filter)) {
break;
} else {
$tempTitle = $translitedTitle . '-' . $i;
}
}
$translitedTitle = $tempTitle;
for ($i = 0, $l = sizeof(E()->getLanguage()->getLanguages()); $i < $l; $i++) {
$f->setRowData($i, $translitedTitle);
}
$data->addField($f);
}
}
示例11: createXml
/**
* 生成接口参数xml
*/
function createXml()
{
//检测必填参数
if ($this->parameters["out_trade_no"] == null) {
E("缺少统一支付接口必填参数out_trade_no!" . "<br>");
} elseif ($this->parameters["body"] == null) {
E("缺少统一支付接口必填参数body!" . "<br>");
} elseif ($this->parameters["total_fee"] == null) {
E("缺少统一支付接口必填参数total_fee!" . "<br>");
} elseif ($this->parameters["notify_url"] == null) {
E("缺少统一支付接口必填参数notify_url!" . "<br>");
} elseif ($this->parameters["trade_type"] == null) {
E("缺少统一支付接口必填参数trade_type!" . "<br>");
} elseif ($this->parameters["trade_type"] == "JSAPI" && $this->parameters["openid"] == NULL) {
E("统一支付接口中,缺少必填参数openid!trade_type为JSAPI时,openid为必填参数!" . "<br>");
}
$this->parameters["appid"] = C('WX_APPID');
//公众账号ID
$this->parameters["mch_id"] = C('WX_MCHID');
//商户号
$this->parameters["spbill_create_ip"] = $_SERVER['REMOTE_ADDR'];
//终端ip
$this->parameters["nonce_str"] = $this->createNoncestr();
//随机字符串
$this->parameters["sign"] = $this->getSign($this->parameters);
//签名
return $this->arrayToXml($this->parameters);
}
示例12: __construct
/**
* @param array $config Configurations.
* @param bool $return
*/
public function __construct($config, $return = false)
{
$this->appId = $config['appId'];
$this->appPublic = $config['public'];
$this->appSecret = $config['secret'];
$this->callbackUrl = ($base = E()->getSiteManager()->getCurrentSite()->base) . 'auth.php?okAuth&return=' . (!$return ? $base : $return);
}
示例13: showResult
/**
* Show result.
*/
protected function showResult()
{
list($formID) = $this->getStateParams();
E()->getRequest()->shiftPath(2);
$this->results = $this->document->componentManager->createComponent('form', 'Energine\\forms\\components\\FormResults', array('form_id' => $formID));
$this->results->run();
}
示例14: http
function http($url, $params, $method = 'GET', $header = array(), $multi = false)
{
$ch = curl_init();
$opts = array(CURLOPT_TIMEOUT => 30, CURLOPT_RETURNTRANSFER => 1, CURLOPT_SSL_VERIFYPEER => false, CURLOPT_SSL_VERIFYHOST => false, CURLOPT_HTTPHEADER => $header);
switch (strtoupper($method)) {
case 'GET':
$opts[CURLOPT_URL] = $url . '?' . http_build_query($params);
break;
case 'POST':
$params = $multi ? $params : http_build_query($params);
$opts[CURLOPT_URL] = $url;
$opts[CURLOPT_POST] = 1;
$opts[CURLOPT_POSTFIELDS] = $params;
break;
default:
E('不支持的请求方式!');
}
curl_setopt_array($ch, $opts);
$output = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if ($error) {
exit('请求发生错误:' . $error);
}
return $output;
}
示例15: build
/**
* @copydoc IBuilder::build
*
* @throws SystemException 'ERR_DEV_NO_DATA_DESCRIPTION'
*/
public function build()
{
$result = false;
if (!$this->dataDescription) {
throw new SystemException('ERR_DEV_NO_DATA_DESCRIPTION', SystemException::ERR_DEVELOPER);
}
foreach ($this->dataDescription as $fieldName => $fieldInfo) {
$result['meta'][$fieldName] = ['title' => $fieldInfo->getPropertyValue('title'), 'type' => $fieldInfo->getType(), 'key' => $fieldInfo->getPropertyValue('key') && $fieldInfo->getPropertyValue('index') == 'PRI' ? true : false, 'visible' => true, 'name' => $fieldInfo->getPropertyValue('tableName') . "[{$fieldName}]", 'rights' => $fieldInfo->getRights(), 'field' => $fieldName, 'sort' => $fieldInfo->getPropertyValue('sort')];
}
if (!$this->data->isEmpty()) {
for ($i = 0; $i < $this->data->getRowCount(); $i++) {
foreach ($this->dataDescription as $fieldName => $fieldInfo) {
$fieldValue = null;
if ($this->data->getFieldByName($fieldName)) {
$fieldValue = $this->data->getFieldByName($fieldName)->getRowData($i);
if (is_null($fieldValue)) {
$fieldValue = '';
}
if ($fieldName == 'upl_publication_date') {
if (!empty($fieldValue)) {
$fieldValue = E()->Utils->formatDate($fieldValue, $fieldInfo->getPropertyValue('outputFormat'), FieldDescription::FIELD_TYPE_DATETIME);
}
}
}
$result['data'][$i][$fieldName] = $fieldValue;
}
}
}
$result['breadcrumbs'] = $this->breadcrumbs;
$result['result'] = true;
$result['mode'] = 'select';
$this->result = $result;
return true;
}