이 코드에서는 SMS 게이트웨이를 사용하여 클라이언트에 메시지를 보냅니다. 이제 SMS는 성공적으로 전송되었지만 형식은 다음과 같이 평범합니다.
This is a remainder about the title by the 2019-11-11 hello
간단하게 보여주고 싶은 메시지는 다음과 같습니다.
This is a remainder about
the title
by 2019-11-11
hello
라인 중단해야 후 about
, title
, date
및message
그래서 어떻게 할 수 있습니까? 제발 도와주세요.
감사합니다
$message = "This is a reminder about the ".$this->input->post("title")." by the ".date("Y-m-d", strtotime($this->input->post("date")))." ".strip_tags(html_entity_decode($this->input->post("notice")))."";
$requestParams = array(
'user' => '**********',
'pass' => '**********',
'sender' => '*******',
'phone' => trim(json_encode($student_phone, JSON_NUMERIC_CHECK),'[]'),
'text' => $message,
'priority' => 'ndnd',
'stype' => 'normal'
);
$apiUrl = "http://bhashsms.com/api/sendmsg.php?";
foreach($requestParams as $key => $val){
$apiUrl .= $key.'='.urlencode($val).'&';
}
$apiUrl = rtrim($apiUrl, "&");
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $apiUrl);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$result = curl_exec($ch);
curl_close($ch);
$return = json_encode($result);
"새 줄"문자로 시도하십시오 \n
. 다음과 같이 문자열에 삽입하십시오.
$message = "This is a reminder about \n the ".$this->input->post("title")."\n by the ".date("Y-m-d", strtotime($this->input->post("date")))."\n".strip_tags(html_entity_decode($this->input->post("notice")))."";
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다