本文整理汇总了PHP中Pw::convert方法的典型用法代码示例。如果您正苦于以下问题:PHP Pw::convert方法的具体用法?PHP Pw::convert怎么用?PHP Pw::convert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pw
的用法示例。
在下文中一共展示了Pw::convert方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUrl
public function getUrl(PwPayVo $vo)
{
$strTransactionId = $vo->getOrderNo();
$strBillDate = substr($strTransactionId, 10, 8);
$strSpBillNo = substr($strTransactionId, -10);
$param = array('cmdno' => '1', 'date' => $strBillDate, 'bargainor_id' => $this->tenpay, 'transaction_id' => $strTransactionId, 'sp_billno' => $strSpBillNo, 'total_fee' => $vo->getFee() * 100, 'bank_type' => 0, 'fee_type' => 1, 'return_url' => $this->baseurl, 'attach' => 'my_magic_string', 'desc' => Pw::convert($vo->getTitle(), 'gbk'));
return $this->_bulidUrl($this->tenpay_url, $this->tenpay_key, $param);
}
示例2: _convert
private static function _convert($text = '')
{
return Pw::convert($text, 'UTF-8');
/*if ($text !== utf8_decode(utf8_encode($text))) {
$text = WindConvert::convert($text, 'UTF-8', 'GBK');
}
return $text;*/
}
示例3: sendMobileMessage
/**
* 发送短信
*
* @return bool
*/
public function sendMobileMessage($mobile, $content)
{
$content = Pw::convert($content, 'UTF-8');
$url = PwApplicationHelper::acloudUrl(array('a' => 'forward', 'do' => 'sendSms', 'mobile' => $mobile, 'content' => $content));
$info = PwApplicationHelper::requestAcloudData($url);
if (!is_array($info)) {
return new PwError('APPCENTER:center.connect.fail');
}
if ($info['code'] !== '0') {
return new PwError($info['msg']);
}
return true;
}
示例4: getIpFromWry
/**
* 根据所给 IP 地址或域名返回所在地区信息
*
* @param string $ip
* @return string
*/
public function getIpFromWry($ip)
{
$unknowIp = "Unknown";
if (!$this->_fp) {
return $unknowIp;
}
$ip = $this->packip($ip);
// 二分法搜索索引区间
$l = 0;
$u = $this->_totalip;
$findip = $this->_lastip;
while ($l <= $u) {
$i = floor(($l + $u) / 2);
fseek($this->_fp, $this->_firstip + $i * 7);
$beginip = strrev(fread($this->_fp, 4));
if ($ip < $beginip) {
$u = $i - 1;
} else {
fseek($this->_fp, $this->getlong3());
$endip = strrev(fread($this->_fp, 4));
if ($ip > $endip) {
$l = $i + 1;
} else {
$findip = $this->_firstip + $i * 7;
break;
}
}
}
//获取查找到的IP地址
fseek($this->_fp, $findip);
$location['beginip'] = long2ip($this->getlong());
$offset = $this->getlong3();
fseek($this->_fp, $offset);
$location['endip'] = long2ip($this->getlong());
$byte = fread($this->_fp, 1);
switch (ord($byte)) {
case 1:
$countryOffset = $this->getlong3();
fseek($this->_fp, $countryOffset);
$byte = fread($this->_fp, 1);
switch (ord($byte)) {
case 2:
fseek($this->_fp, $this->getlong3());
$country = $this->getstring();
fseek($this->_fp, $countryOffset + 4);
$area = $this->getarea();
break;
default:
$country = $this->getstring($byte);
$area = $this->getarea();
break;
}
break;
case 2:
fseek($this->_fp, $this->getlong3());
$country = $this->getstring();
fseek($this->_fp, $offset + 8);
$area = $this->getarea();
break;
default:
$country = $this->getstring($byte);
$area = $this->getarea();
break;
}
if ($country == " CZ88.NET") {
$country = $unknowIp;
}
if ($area == " CZ88.NET") {
$area = "";
}
return Pw::convert($country . $area, 'GBK');
}
示例5: downloadAction
public function downloadAction()
{
$aid = (int) $this->getInput('aid', 'get');
$submit = (int) $this->getInput('submit', 'post');
$attach = Wekit::load('attach.PwThreadAttach')->getAttach($aid);
if (!$attach) {
$this->showError('BBS:thread.buy.attach.error');
}
Wind::import('SRV:forum.bo.PwForumBo');
$forum = new PwForumBo($attach['fid']);
if (!$forum->isForum()) {
$this->showError('data.error');
}
if ($attach['cost'] && !$this->loginUser->isExists()) {
$this->showError('download.fail.login.not', 'bbs/attach/download');
}
if (!$forum->allowDownload($this->loginUser)) {
if (!$this->loginUser->isExists()) {
$this->showError('download.fail.login.not', 'bbs/attach/download');
}
$this->showError(array('BBS:forum.permissions.download.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
}
if (!$forum->foruminfo['allow_download'] && !$this->loginUser->getPermission('allow_download')) {
if (!$this->loginUser->isExists()) {
$this->showError('download.fail.login.not', 'bbs/attach/download');
}
$this->showError(array('permission.download.allow', array('{grouptitle}' => $this->loginUser->getGroupInfo('name'))));
}
Wind::import('SRV:credit.bo.PwCreditBo');
$creditBo = PwCreditBo::getInstance();
// 购买积分检查
if (($attach = $this->_checkAttachCost($attach)) instanceof PwError) {
$this->showError($attach->getError());
}
// 下载积分检查
if (($reduceDownload = $this->_checkAttachDownload('download_att', $attach, $forum)) instanceof PwError) {
$this->showError($reduceDownload->getError());
}
//下载积分提示
$lang = Wind::getComponent('i18n');
if (1 == $this->loginUser->getPermission('allow_download') && $reduceDownload && $attach['cost']) {
$dataShow = $lang->getMessage('BBS:thread.attachbuy.message.all', array('{buyCount}' => -$attach['cost'] . $creditBo->cType[$attach['ctype']], '{downCount}' => rtrim($reduceDownload, ',')));
} elseif (1 == $this->loginUser->getPermission('allow_download') && $reduceDownload && !$attach['cost']) {
$dataShow = $lang->getMessage('BBS:thread.attachbuy.message.download', array('{downCount}' => rtrim($reduceDownload, ',')));
} elseif ($attach['cost']) {
$dataShow = $lang->getMessage('BBS:thread.attachbuy.message.buy', array('{count}' => $this->loginUser->getCredit($attach['ctype']) . $creditBo->cType[$attach['ctype']], '{buyCount}' => -$attach['cost'] . $creditBo->cType[$attach['ctype']]));
} else {
$dataShow = $lang->getMessage('BBS:thread.attachbuy.message.success');
}
!$submit && $this->showMessage($dataShow);
//购买积分操作
$this->_operateBuyCredit($attach);
// 下载积分
if ($reduceDownload) {
Wind::import('SRV:attach.dm.PwThreadAttachBuyDm');
$dm = new PwThreadAttachBuyDm();
$dm->setAid($aid)->setCreatedUserid($this->loginUser->uid)->setCreatedTime(Pw::getTime())->setCtype($attach['ctype'])->setCost($attach['cost']);
Wekit::load('attach.PwThreadAttachDownload')->add($dm);
$this->_operateCredit('download_att', $forum);
}
//更新附件点击数
Wind::import('SRV:attach.dm.PwThreadAttachDm');
$dm = new PwThreadAttachDm($aid);
$dm->addHits(1);
Wekit::load('attach.PwThreadAttach')->updateAttach($dm);
$filename = basename($attach['path']);
$fileext = substr(strrchr($attach['path'], '.'), 1);
$filesize = 0;
if (strpos(Wind::getApp()->getRequest()->getServer('HTTP_USER_AGENT'), 'MSIE') !== false && $fileext == 'torrent') {
$attachment = 'inline';
} else {
$attachment = 'attachment';
}
$attach['name'] = trim(str_replace(' ', ' ', $attach['name']));
if (strtoupper(Wekit::V('charset')) == 'UTF-8') {
$attach['name'] = Pw::convert($attach['name'], "gbk", 'utf-8');
}
$filesize = 0;
$fgeturl = Wind::getComponent('storage')->getDownloadUrl($attach['path']);
if (strpos($fgeturl, 'http') !== 0) {
if (!is_readable($fgeturl)) {
$this->showError('BBS:thread.buy.attach.error');
}
$filesize = filesize($fgeturl);
}
$timestamp = Pw::getTime();
$ctype = '';
switch ($fileext) {
case "pdf":
$ctype = "application/pdf";
break;
case "rar":
case "zip":
$ctype = "application/zip";
break;
case "doc":
$ctype = "application/msword";
break;
case "xls":
$ctype = "application/vnd.ms-excel";
//.........这里部分代码省略.........
示例6: setUrl
public function setUrl($url)
{
$this->_data['url'] = Pw::convert(trim($url), Wind::getApp()->getResponse()->getCharset(), 'UTF-8');
return $this;
}
示例7: updateSession
/**
* 更新session
*/
protected function updateSession($user_id, $nick, $type)
{
$sessionId = Pw::getCookie($this->_getLoginSessionService()->getCookieName());
$bindInfo = $this->_getAccountBindDs()->getByAppUidAndType($user_id, $type);
$isBound = $bindInfo ? 1 : 0;
$bbsUid = intval($bindInfo['uid']) ? intval($bindInfo['uid']) : 0;
if ($type != 'alipay') {
$nick = Pw::convert(trim($nick), Wind::getApp()->getResponse()->getCharset(), 'UTF-8');
}
$data = array('data' => array('nick' => $nick, 'user_id' => $user_id, 'isBound' => $isBound, 'bbs_uid' => $bbsUid, 'sign' => $this->getSignSting()));
$this->_getLoginSessionService()->updateLoginSession($sessionId, $data);
}
示例8: setNick
public function setNick($nick)
{
$this->_data['nick'] = Pw::convert(trim($nick), Wind::getApp()->getResponse()->getCharset(), 'UTF-8');
return $this;
}
示例9: setGender
public function setGender($gender)
{
$this->_data['gender'] = Pw::convert(trim($gender), Wind::getApp()->getResponse()->getCharset(), 'UTF-8');
return $this;
}