本文整理匯總了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)));
}/*}}}*/