本文整理汇总了PHP中strexists函数的典型用法代码示例。如果您正苦于以下问题:PHP strexists函数的具体用法?PHP strexists怎么用?PHP strexists使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了strexists函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAttachment
public function getAttachment()
{
global $_G;
try {
$taskData = $this->checkTask();
} catch (Exception $e) {
throw new Cloud_Exception($e);
}
$task = $taskData['task'];
$attach = $taskData['attach'];
$taskId = $task['taskid'];
C::t('#qqconnect#connect_disktask')->update($taskId, array('status' => 1, 'downloadtime' => $_G['timestamp']));
$db = DB::object();
$db->close();
ob_end_clean();
$attach['filename'] = '"' . (strtolower(CHARSET) == 'utf-8' && strexists($_SERVER['HTTP_USER_AGENT'], 'MSIE') ? urlencode($attach['filename']) : $attach['filename']) . '"';
dheader('Content-Type: application/octet-stream');
dheader('Content-Length: ' . $attach['filesize']);
dheader('Content-Disposition: attachment; filename=' . $attach['filename']);
self::_checkXSendFile($attach['attachment']);
if ($attach['remote']) {
self::_getRemoteFile($attach['attachment']);
} else {
self::_getLocalFile($attach['attachment']);
}
exit;
}
示例2: respond
public function respond()
{
global $_W;
load()->func('compat.biz');
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('bm_top_reply') . " WHERE `rid`=:rid LIMIT 1";
$row = pdo_fetch($sql, array(':rid' => $rid));
if (empty($row['id'])) {
return $this->respText("系统升级中,请稍候!");
}
$desc = $row['desc'];
//描述
$n = $row['n'];
//粉丝基数
$fromuser = $this->message['from'];
$num = mc_fansinfo($fromuser);
$numx = $n + $num['fanid'];
$name = $_W['account']['name'];
//公众号名称
$str = str_replace('{name}', $name, $desc);
$str = str_replace('{numx}', $numx, $str);
if ($row['pictype'] == 1) {
//$str = "嗨,欢迎关注【".$name."】,您是第".$numx."位关注人!\n".$desc."\n <a href='".$url."'>".$urltext."</a>";
return $this->respText($str);
} else {
$response['FromUserName'] = $this->message['to'];
$response['ToUserName'] = $this->message['from'];
$response['MsgType'] = 'news';
$response['ArticleCount'] = 1;
$response['Articles'] = array();
$response['Articles'][] = array('Title' => $row['title'], 'Description' => $str, 'PicUrl' => !strexists($row['picurl'], 'http://') ? $_W['attachurl'] . $row['picurl'] : $row['picurl'], 'Url' => $row['urlx'], 'TagName' => 'item');
return $response;
}
}
示例3: tpl_form_field_clock
function tpl_form_field_clock($name, $value = '')
{
$s = '';
if (!defined('TPL_INIT_CLOCK_TIME')) {
$s .= '
<script type="text/javascript">
require(["clockpicker"], function($){
$(function(){
$(".clockpicker").clockpicker({
autoclose: true
});
});
});
</script>
';
define('TPL_INIT_CLOCK_TIME', 1);
}
$time = date('H:i');
if (!empty($value)) {
if (!strexists($value, ':')) {
$time = date('H:i', $value);
} else {
$time = $value;
}
}
$s .= ' <div class="input-group clockpicker">
<span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
<input type="text" name="' . $name . '" value="' . $time . '" class="form-control">
</div>';
return $s;
}
示例4: respond
public function respond()
{
global $_W;
load()->func('compat.biz');
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('bm_qrsign_reply') . " WHERE `rid`=:rid LIMIT 1";
$reply = pdo_fetch($sql, array(':rid' => $rid));
if (empty($reply['id'])) {
return $this->respText("系统升级中,请稍候!");
}
if (time() > strtotime($reply['endtime'])) {
if (empty($reply['memo2'])) {
$msg = '对不起,活动已经于' . $reply['endtime'] . '结束,感谢您的参与!!!';
} else {
$msg = $reply['memo2'];
}
return $this->respText($msg);
}
if (time() < strtotime($reply['starttime'])) {
if (empty($reply['memo1'])) {
$msg = '对不起,活动将于' . $reply['starttime'] . '开始,敬请期待!!!';
} else {
$msg = $reply['memo1'];
}
return $this->respText($msg);
}
$url = $_W['siteroot'] . 'app/' . $this->createMobileUrl('show', array('rid' => $rid, 'from_user' => $this->message['from']));
$response['FromUserName'] = $this->message['to'];
$response['ToUserName'] = $this->message['from'];
$response['MsgType'] = 'news';
$response['ArticleCount'] = 1;
$response['Articles'] = array();
$response['Articles'][] = array('Title' => $reply['title'], 'Description' => $reply['desc'], 'PicUrl' => !strexists($reply['picurl'], 'http://') ? $_W['attachurl'] . $reply['picurl'] : $reply['picurl'], 'Url' => $url, 'TagName' => 'item');
return $response;
}
示例5: del
/**
* 删除指定ID信息
*
* @param unknown_type $id
* @return unknown
*/
function del($id, $uname = "", $other = "")
{
if (is_numeric($id)) {
$wherestr[] = $this->idname . " = " . $id;
} elseif (is_array($id)) {
$ids = getdotstring($id, 'int');
$wherestr[] = $this->idname . " in ({$ids})";
} elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) {
if (strexists($id, ',')) {
$ids = getdotstring($id, 'int');
} else {
$ids = getdotstring(explode('|', $ids), 'int');
}
$wherestr[] = $this->idname . " in ({$ids})";
} else {
return lang('ID_format_error');
}
if ($uname != "") {
$wherestr[] = "uname = '" . $uname . "'";
}
if ($other != "") {
$wherestr[] = $other;
}
$wheresql = implode(' AND ', $wherestr);
//条件汇总
$this->db->query("delete from {$this->table} where " . $wheresql);
return "OK";
}
示例6: fans_search
function fans_search($user, $fields = array())
{
global $_W;
$struct = cache_load('fansfields');
if (empty($fields)) {
$select = '*';
} else {
foreach ($fields as $field) {
if (!in_array($field, $struct)) {
unset($fields[$field]);
}
}
$select = '`from_user`, `' . implode('`,`', $fields) . '`';
}
$result = pdo_fetchall("SELECT {$select} FROM " . tablename('fans') . " WHERE from_user IN ('" . implode("','", is_array($user) ? $user : array($user)) . "')", array(), 'from_user');
if (!empty($result)) {
foreach ($result as &$row) {
if (!empty($row['avatar'])) {
if (strexists($row['avatar'], 'avatar_')) {
$row['avatar'] = $_W['siteroot'] . 'resource/image/avatar/' . $row['avatar'];
} elseif (strexists($row['avatar'], 'http')) {
} else {
$row['avatar'] = $_W['attachurl'] . $row['avatar'];
}
}
}
if (is_array($user)) {
return $result;
} else {
return $result[$user];
}
} else {
return array();
}
}
示例7: LocationLogoupload
public function LocationLogoupload($logo)
{
global $_W;
if (!strexists($logo, 'http://') && !strexists($logo, 'https://')) {
$path = rtrim(IA_ROOT . '/' . $_W['config']['upload']['attachdir'], '/') . '/';
if (empty($logo) || !file_exists($path . $logo)) {
return error(-1, '商户LOGO不存在');
}
} else {
return error(-1, '商户LOGO只能上传本地图片');
}
$token = $this->fetch_token();
if (is_error($token)) {
return $token;
}
$url = "https://api.weixin.qq.com/cgi-bin/media/uploadimg?access_token={$token}";
$data = array('buffer' => '@' . $path . $logo);
load()->func('communication');
$response = ihttp_request($url, $data);
if (is_error($response)) {
return error(-1, "访问公众平台接口失败, 错误: {$response['message']}");
}
$result = @json_decode($response['content'], true);
if (empty($result)) {
return error(-1, "接口调用失败, 元数据: {$response['meta']}");
} elseif (!empty($result['errcode'])) {
return error(-1, "访问微信接口错误, 错误代码: {$result['errcode']}, 错误信息: {$result['errmsg']},信息详情:{$this->error_code($result['errcode'])}");
}
return $result;
}
示例8: checkmagicperm
function checkmagicperm($perms, $id)
{
$id = $id ? intval($id) : '';
if (!strexists("\t" . trim($perms) . "\t", "\t" . trim($id) . "\t") && $perms) {
showmessage('magics_target_nopermission');
}
}
示例9: runlog
function runlog($log, $file = 'wechat', $halt = 0)
{
global $_SGLOBAL, $_SERVER;
$nowurl = $_SERVER['REQUEST_URI'] ? $_SERVER['REQUEST_URI'] : ($_SERVER['PHP_SELF'] ? $_SERVER['PHP_SELF'] : $_SERVER['SCRIPT_NAME']);
$log = gmdate('Y-m-d H:i:s', $_SGLOBAL['timestamp']) . "\t{$type}\t" . "\t{$nowurl}\t" . str_replace(array("\r", "\n"), array(' ', ' '), trim($log)) . "\n";
$yearmonth = gmdate('Ym', $_SGLOBAL['timestamp']);
$logdir = './data/log/';
if (!is_dir($logdir)) {
mkdir($logdir, 0777);
}
$logfile = $logdir . $yearmonth . '_' . $file . '.php';
if (@filesize($logfile) > 2048000) {
$dir = opendir($logdir);
$length = strlen($file);
$maxid = $id = 0;
while ($entry = readdir($dir)) {
if (strexists($entry, $yearmonth . '_' . $file)) {
$id = intval(substr($entry, $length + 8, -4));
$id > $maxid && ($maxid = $id);
}
}
closedir($dir);
$logfilebak = $logdir . $yearmonth . '_' . $file . '_' . ($maxid + 1) . '.php';
@rename($logfile, $logfilebak);
}
if ($fp = @fopen($logfile, 'a')) {
@flock($fp, 2);
fwrite($fp, "<?PHP exit;?>\t" . str_replace(array('<?', '?>', "\r", "\n"), '', $log) . "\n");
fclose($fp);
}
if ($halt) {
exit;
}
}
示例10: fieldsFormDisplay
public function fieldsFormDisplay($rid = 0)
{
global $_W;
if (!empty($rid)) {
$row = pdo_fetch("SELECT * FROM " . tablename($this->tablename) . " WHERE rid = :rid ORDER BY `id` DESC", array(':rid' => $rid));
if (!strexists($row['apiurl'], 'http://') && !strexists($row['apiurl'], 'https://')) {
$row['apilocal'] = $row['apiurl'];
$row['apiurl'] = '';
}
} else {
$row = array('cachetime' => 0);
}
$path = IA_ROOT . '/source/modules/userapi/api';
if (is_dir($path)) {
$apis = array();
if ($handle = opendir($path)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
$apis[] = $file;
}
}
}
}
include $this->template('form');
}
示例11: helplist
function helplist($num, $id = '', $aids = "", $orderby = "aid asc")
{
if (is_numeric($id)) {
$wherestr[] = "typeid = " . $id;
} elseif (is_array($id)) {
$ids = getdotstring($id, 'int');
$wherestr[] = "typeid in ({$ids})";
} elseif (is_string($id) && (strexists($id, ',') || strexists($id, '|'))) {
if (strexists($id, ',')) {
$ids = getdotstring($id, 'int');
} else {
$ids = getdotstring(explode('|', $ids), 'int');
}
$wherestr[] = "typeid in ({$ids})";
} else {
$wherestr[] = "";
}
if (!empty($aids)) {
$aids = getdotstring($aids, 'int');
$wherestr[] = "aid in ({$ids})";
}
$num = GetNum($num);
$wheresql = implode(' AND ', $wherestr);
//条件汇总
$articleobj = new TableClass('article', 'aid');
$articlearray = $articleobj->getdata($num, $wheresql, $orderby, 'aid,typeid,title');
return $articlearray;
}
示例12: respond
public function respond()
{
global $_W;
$content = $this->message['content'];
$reply = pdo_fetch('SELECT * FROM ' . tablename('cover_reply') . ' WHERE `rid`=:rid', array(':rid' => $this->rule));
if (!empty($reply)) {
load()->model('module');
$module = module_fetch($reply['module']);
if (empty($module) && !in_array($reply['module'], array('site', 'mc', 'card'))) {
return '';
}
$url = $reply['url'];
if (empty($reply['url'])) {
$entry = pdo_fetch("SELECT eid FROM " . tablename('modules_bindings') . " WHERE module = :module AND do = :do", array(':module' => $reply['module'], ':do' => $reply['do']));
$url = url('entry', array('eid' => $entry['eid']));
}
if (!strexists($url, '&j=') && !empty($_W['acid'])) {
$url = str_replace("?i={$_W['uniacid']}&", "?i={$_W['uniacid']}&j={$_W['acid']}&", $url);
}
$news = array();
$news[] = array('title' => $reply['title'], 'description' => $reply['description'], 'picurl' => $reply['thumb'], 'url' => $url);
return $this->respNews($news);
}
return '';
}
示例13: doMobileDetail
public function doMobileDetail()
{
global $_W, $_GPC;
checkauth();
$rid = intval($_GPC['rid']);
$reply = pdo_fetch("SELECT * FROM " . tablename('shake_reply') . " WHERE rid = :rid", array(':rid' => $rid));
if (empty($reply)) {
message('抱歉,此活动不存在或是还未开始!', 'refresh', 'error');
}
$member = pdo_fetch("SELECT * FROM " . tablename('shake_member') . " WHERE rid = :rid AND openid = :openid", array(':rid' => $reply['rid'], ':openid' => $_W['member']['uid']));
if (empty($member)) {
$member = array('rid' => $rid, 'openid' => $_W['member']['uid'], 'createtime' => TIMESTAMP, 'shakecount' => 0, 'status' => 0);
$maxjoin = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('shake_member') . " WHERE rid = '{$reply['rid']}' AND status = '1'");
if ($maxjoin < $reply['maxjoin']) {
mt_srand((double) microtime() * 1000000);
$rand = mt_rand(1, 100);
if ($rand <= $reply['joinprobability']) {
$member['status'] = 1;
}
}
pdo_insert('shake_member', $member);
}
if (strexists(strtolower($_SERVER['HTTP_USER_AGENT']), 'android')) {
$reply['speed'] = $reply['speedandroid'];
}
include $this->template('detail');
}
示例14: message
function message($msg, $redirect = '', $type = '')
{
global $_W;
if ($redirect == 'refresh') {
$redirect = $_W['script_name'] . '?' . $_SERVER['QUERY_STRING'];
} elseif (!empty($redirect) && !strexists($redirect, 'http://')) {
$urls = parse_url($redirect);
$redirect = $_W['siteroot'] . 'app/index.php?' . $urls['query'];
}
if ($redirect == '') {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'info';
} else {
$type = in_array($type, array('success', 'error', 'info', 'warning', 'ajax', 'sql')) ? $type : 'success';
}
if ($_W['isajax'] || $type == 'ajax') {
$vars = array();
$vars['message'] = $msg;
$vars['redirect'] = $redirect;
$vars['type'] = $type;
exit(json_encode($vars));
}
if (empty($msg) && !empty($redirect)) {
header('location: ' . $redirect);
}
$label = $type;
if ($type == 'error') {
$label = 'danger';
}
if ($type == 'ajax' || $type == 'sql') {
$label = 'warning';
}
include template('common/message', TEMPLATE_INCLUDEPATH);
exit;
}
示例15: tpl_form_field_clock
function tpl_form_field_clock($name, $value = '')
{
$s = '';
if (!defined('TPL_INIT_CLOCK_TIME')) {
app()->view->registerJs(<<<EOF
require(['clockpicker'], function(\$) {
\$(".clockpicker").clockpicker({
autoclose: true
});
});
EOF
);
define('TPL_INIT_CLOCK_TIME', 1);
}
$time = date('H:i');
if (!empty($value)) {
if (!strexists($value, ':')) {
$time = date('H:i', $value);
} else {
$time = $value;
}
}
$s .= ' <div class="input-group clockpicker">
<span class="input-group-addon"><i class="fa fa-clock-o"></i></span>
<input type="text" name="' . $name . '" value="' . $time . '" class="form-control">
</div>';
return $s;
}