我有一个 struct 类型的主题:
type Topic struct {
Forum_id int
Topic_id int
Author string
Title string
Sub_Title string
Body string
}
和一个Replay类型的切片:
type Replay struct {
Replay_ID int
Topic_ID int
Author string
Body string
}
我需要将数据传递到模板中,如果只用一个变量传递它,我应该怎么做?然后,我应该如何在我的模板中访问它?