本文整理汇总了PHP中Imit_L函数的典型用法代码示例。如果您正苦于以下问题:PHP Imit_L函数的具体用法?PHP Imit_L怎么用?PHP Imit_L使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Imit_L函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: connect
protected function connect()
{
global $sae_config;
if (empty($sae_config['db_name'])) {
die(Imit_L('_SAE_PLEASE_CONFIG_DB_'));
}
self::$link = mysql_connect(SAE_MYSQL_HOST_M, SAE_MYSQL_USER, SAE_MYSQL_PASS) or die(Imit_L('_SAE_CONNECT_DB_ERR_'));
mysql_select_db(SAE_MYSQL_DB, self::$link);
mysql_query("set names " . self::$charset, self::$link);
if (!mysql_select_db(SAE_MYSQL_DB, self::$link)) {
//如果数据库不存在,自动建立
mysql_query('create database ' . SAE_MYSQL_DB, self::$link);
mysql_select_db(SAE_MYSQL_DB, self::$link) or Imit_L('_SAE_DATABASE_NOT_EXIST_');
}
}
示例2: __construct
public function __construct()
{
$this->errmsg = Imit_L("_SAE_OK_");
static $inited = false;
//只初始化一次
if ($inited) {
return;
}
if (extension_loaded('sqlite3')) {
self::$db = new ImitSqlite();
} else {
self::$db = get_class($this) == "SaeMysql" ? $this : new SaeMysql();
$this->createTable();
}
$inited = true;
}
示例3: write
public function write($domain, $destFileName, $content, $size = -1, $attr = array(), $compress = false)
{
if (empty($domain) || empty($destFileName)) {
$this->errmsg = Imit_L("_SAE_STORAGE_PARAM_EMPTY_") . "[the value of parameter (domain,destFileName,content) can not be empty!]";
$this->errno = -101;
return false;
}
//定义文件路径
$filepath = $this->domainDir . $domain . "/" . $destFileName;
$this->mkdir(dirname($filepath));
//设置长度
if ($size > -1) {
$content = substr($content, 0, $size);
}
//写入文件
if (file_put_contents($filepath, $content)) {
return true;
} else {
$this->errmsg = Imit_L('_SAE_STORAGE_SERVER_ERR_');
$this->errno = -12;
return false;
}
}
示例4: Imit_L
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2010 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: luofei614 <www.3g4k.com>
// +----------------------------------------------------------------------
// $Id$
Imit_L(array('_SAE_DATABASE_NOT_EXIST_' => '数据库[' . SAE_MYSQL_DB . ']不存在', '_SAE_NOT_IN_BILLBOARD_' => '查找元素没有在排行榜中[not in billboard]', '_SAE_BILLBOARD_NOT_EXISTS_' => '排行榜不存在[billboard not exists]', '_SAE_THE_RANK_IS_EXISTED_' => '排行榜已存在[the rank is existed]', '_SAE_ERR_' => 'SAE内部错误', '_SAE_OK_' => '操作成功[OK]', '_SAE_ERRPARAMTER_' => '参数错误[Unavailable tasks]', '_SAE_TASKQUEUE_SERVICE_FAULT_' => '服务内部错误[taskqueue service segment fault]', '_SAE_TASKQUEUE_SERVICE_ERROR_' => '服务内部错误[taskqueue service internal error]', '_SAE_UNKNOWN_ERROR_' => '未知错误[unknown error]', '_SAE_STORAGE_PARAM_EMPTY_' => '参数错误', '_SAE_STORAGE_SERVER_ERR_' => '存储服务器返回错误', '_SAE_STORAGE_DELETE_ERR_' => '删除失败[deleted failed!...]', '_SAE_STORAGE_FILE_NOT_EXISTS_' => '文件不存在', '_SAE_MAIL_SIZE_lARGER_' => '邮件内容过大[mail size cannot larger than 1048576 bytes]', '_SAE_CONNECT_DB_ERR_' => '数据库连接失败', '_SAE_PLEASE_CONFIG_DB_' => '请配置数据库'));
示例5: setOpt
public function setOpt($options)
{
if (isset($options['subject']) && strlen($options['subject']) > self::subject_limitsize) {
$this->errno = SAE_ErrParameter;
$this->errmsg = Imit_L("_SAE_MAIL_SIZE_lARGER_");
return false;
}
if (isset($options['content'])) {
$this->_count = $this->_attachSize + strlen($options['content']);
}
if ($this->_count > self::mail_limitsize) {
$this->errno = SAE_ErrParameter;
$this->errmsg = Imit_L("_SAE_MAIL_SIZE_lARGER_");
return false;
}
$this->_post = array_merge($this->_post, $options);
return true;
}
示例6: emptyName
private function emptyName($name)
{
$num = self::$db->getVar("select count(*) from sae_rank where namespace='{$name}'");
if ($num == 0) {
return true;
} else {
$this->errno = -4;
$this->errmsg = Imit_L("_SAE_BILLBOARD_NOT_EXISTS_");
return false;
}
}
示例7: push
public function push()
{
//todu, 当用户环境不支持curl时用socket发送。
if (empty($this->queue)) {
return false;
}
$s = curl_init();
foreach ($this->queue as $k => $v) {
curl_setopt($s, CURLOPT_URL, $v['url']);
//curl_setopt($s,CURLOPT_TIMEOUT,5);
curl_setopt($s, CURLOPT_RETURNTRANSFER, true);
curl_setopt($s, CURLOPT_HEADER, 1);
curl_setopt($s, CURLINFO_HEADER_OUT, true);
curl_setopt($s, CURLOPT_POST, true);
curl_setopt($s, CURLOPT_POSTFIELDS, $v['postdata']);
$ret = curl_exec($s);
$info = curl_getinfo($s);
// print_r($info);
if (empty($info['http_code'])) {
$this->errno = SAE_ErrInternal;
$this->errmsg = Imit_L("_SAE_TASKQUEUE_SERVICE_FAULT_");
return false;
} else {
if ($info['http_code'] != 200) {
$this->errno = SAE_ErrInternal;
$this->errmsg = Imit_L("_SAE_TASKQUEUE_SERVICE_ERROR_");
return false;
} else {
//todu 这里好像有些问题
if ($info['size_download'] == 0) {
// get MailError header
$this->errno = SAE_ErrUnknown;
$this->errmsg = Imit_L("_SAE_UNKNOWN_ERROR_");
return false;
}
}
}
}
//循环结束
$this->queue = array();
//清空列队
return true;
}