为什么我echo出来的东西就是一个%s?而不是我赋值的字符串?

完整代码:
IndexAction.class.php
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
FromUserName;
$toUsername = $postObj->ToUserName;
$textTpl = "
%s
";
echo "textTpl is: ".$textTpl;
$resultStr = sprintf($textTpl, $fromUsername, $toUsername, $time, $content);
// echo $resultStr;
}
}
?>
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
浏览器F12去看,多余的xml代码就可以看到了。
浏览器也能解析 XML 的, 查看页面源码就就能看见了
你本来就是echo的tpl,输出%s没什么不对