Skip to content

留言板

默认皮肤用原生 POST,不要 fetch

表单标签

标签说明
{echo:msgaction/}提交地址 /guestbook
{echo:checkcode/}验证码图片 /checkcode
{echo:msgcodestatus/}1 开 / 0
{echo:formtoken/}CSRF 隐藏域
{echo:msgresult/}失败提示

成功 302 到主题 success.htm(可缺省)。

html
<form action="{echo:msgaction/}" method="post">
  {echo:formtoken/}
  <input name="name" required>
  <textarea name="content" required></textarea>
  {echo:if condition="[field:msgcodestatus]"}
  <input name="checkcode" required>
  <img src="{echo:checkcode/}" alt="验证码">
  {/echo:if}
  <button type="submit">提交</button>
</form>
<p>{echo:msgresult/}</p>

字段:namephoneemailcontent(content 必填)。

后台「互动 → 留言 → 字段」可新增扩展字段(例如 company)。定义只决定提交时认哪些 name;HTML 仍写在 guestbook.htm,增加 <input name="company" class="form-control">。不要用 {echo:form code="guestbook"/} 提交留言。


{echo:guestbook} / {/echo:guestbook}

循环已回复留言。

html
{echo:guestbook num="20"}
<div>[field:name/]:[field:content/]</div>
<div>回复:[field:reply/]</div>
{/echo:guestbook}

可选 JSON:POST /api/guestbook(无验证码)。

山与海都很美,努力走出去