本文整理汇总了PHP中XString::getLengthOfGBKString方法的典型用法代码示例。如果您正苦于以下问题:PHP XString::getLengthOfGBKString方法的具体用法?PHP XString::getLengthOfGBKString怎么用?PHP XString::getLengthOfGBKString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XString
的用法示例。
在下文中一共展示了XString::getLengthOfGBKString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveThreadTitle
public function saveThreadTitle($request, $response)
{/*{{{*/
$threadTitle = XString::convertToGbk($request->threadtitle);
if(trim($threadTitle) == "")
{
throw new BizException("标题不能为空");
}
if(XString::getLengthOfGBKString($_REQUEST['threadtitle'])>25)
{
throw new BizException('标题不能超过25字');
}
if(XString::getLengthOfGBKString($_REQUEST['threadtitle'])<5)
{
throw new BizException('标题不能少于5字');
}
AskSessionInfo::modifyThreadTitle($threadTitle);
$response->threadTitle = AskSessionInfo::getThreadTitle();
}/*}}}*/
示例2: collectMedicineInfo
private function collectMedicineInfo($request, $response)
{/*{{{*/
if(XString::getLengthOfGBKString($_REQUEST['medname'])<1 || XString::getLengthOfGBKString($_REQUEST['medname'])>35)
{
throw new BizException('用药名称为必填信息且不能超过35字');
}
if(XString::getLengthOfGBKString($_REQUEST['meddesc'])<1 || XString::getLengthOfGBKString($_REQUEST['meddesc'])>100)
{
throw new BizException('服用说明必填信息且不能超过100字');
}
$medicineName = XString::convertUTF8ToGBK(ltrim($request->medicineName));
$medicineDesc = XString::convertUTF8ToGBK(ltrim($request->medicineDesc));
$medicine = BingLiDto::createMedicineDto($medicineName, $medicineDesc);
return $medicine;
}/*}}}*/
示例3: add
public function add($request, $response)
{/*{{{*/
$this->breakIfLessMessage($request, $response);
if ($response->isQQ)
{
$this->checkLogin($request, $response);
}
$isLogin = UserClient::getInstance()->isLogin();
if ($isLogin == true)
{
$curUser = $this->_newUser;
}
else
{
$username = $request->username;
$password = $request->password;
$curUser = UserClient::getInstance()->register($username, $password);
User::sendRegisterMsg($curUser->id);
$curUser = UserClient::getInstance()->login($username, $password, false, null, $this->partnerDomain);
}
if ($curUser->isNull())
{
throw new BizException('该邮箱已被注册!');;
}
if (false == $curUser->allowQuestion())
{
throw new BizException('不允许提问');
}
$patient = $this->getPatient($request, $curUser);
$space = DAL::get()->find('space', $request->host_id);
$ip = RequestDelegate::getIp();
$diseaseDto = BingLiDto::createDiseaseDto(XString::convertToGbk($request->case_disease_tag), $patient->id);
$titleDto = BingLiDto::createTitleDto(XString::convertToGbk($request->case_title), $patient->id);
$hospitalDto = BingLiDto::createHospitalDto(XString::convertToGbk($request->case_prehospital), XString::convertToGbk($request->case_prekeshi), $patient->id);
$hopeHelpDto = BingLiDto::createHopeHelpDto(XString::convertToGbk($request->post_help), $patient->id);
$content = "检查及化验:\n".XString::convertToGbk($request->post_content).
"\n治疗情况(当前用药或近期手术):\n".XString::convertToGbk($request->post_effects).
"\n病史:\n".XString::convertToGbk($request->post_history);
if(XString::getLengthOfGBKString(XString::getLengthOfGBKString($content)>1000))
{
throw new BizException('请精简您所填写的病情信息');
}
$contentDto = BingLiDto::createConditionDescDto($content, $patient->id);
$realBingLiDtos = NodeClient::getInstance()->addBingLis(array(
$diseaseDto, $titleDto, $hospitalDto, $hopeHelpDto, $contentDto,
), NodeObj::SOURCE_PATIENT);
if(false == $space->isNull())
{
$product = ProductClient::getInstance()->getFirstFlowProduct($space);
}
else
{
$product = FirstFlowPoolVirtualProduct::fetch();
}
SpaceClient::getInstance()->ensureAllowAskRule($curUser, $space);
$src = $_SERVER['HTTP_HOST'];
$intention = IntentionClient::getInstance()->createWithProduct($patient, $product, $src, $realBingLiDtos, $ip);
$response->setRedirect('http://'.$_SERVER['HTTP_HOST'].$response->router->urlfor('thread/finish', array('threadId' => $intention->id)));
}/*}}}*/