php有多少种占位符,php 占位符问题?
為什么我echo出來的東西就是一個%s?而不是我賦值的字符串?
完整代碼:
IndexAction.class.php
// 本類由系統自動生成,僅供測試用途
class IndexAction extends Action {
public function index(){
$this->responseMsg();
}
public function responseMsg(){
$postStr="
1348831860
1234567890123456
";
$postObj = simplexml_load_string($postStr);
$fromUsername = $postObj->FromUserName;
//echo $fromUsername;
//echo '111';
$toUsername = $postObj->ToUserName;
$time = time();
$msgType = $postObj->MsgType;
$content = $postObj->Content;
if($content=='tel'){
$indexModel=new IndexModel();
$indexModel->responseText($postObj,$content);
}
}
}
IndexModel.class.php
class IndexModel extends Model{
//回復純文本
public function responseText($postObj,$content) {
$time=time();
$fromUsername = $postObj->FromUserName;
$toUsername = $postObj->ToUserName;
$textTpl = "
%s
";
echo "textTpl is: ".$textTpl;
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $content);
// echo $resultStr;
}
}
?>
總結
以上是生活随笔為你收集整理的php有多少种占位符,php 占位符问题?的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: cad大理石填充图案_CAD制图初学入门
- 下一篇: hasp运行不成功_提问:程序无报错或警