已变为命令的语句
动作就是命令,因此其结果可以在表达式中使用。
| 之前 | 现在 |
|---|---|
write 语句 |
@write_text(path, text)、@append_text(path, text) 或 @write_json(path, value)(KScript.IO) |
move 和 copy 语句 |
@move(from, to)、@copy(from, to)(KScript.IO) |
delete 语句 |
@delete(path)(KScript.IO) |
mkdir 语句 |
@create_folder(path)(KScript.IO) |
assert 语句 |
@assert(condition, message?)(KScript.Test) |
stylesheet 语句 |
@stylesheet(path, vars?),返回 CSS:@write_text('site.css', @stylesheet('theme.ks.css'))(KScript.Style) |
dispatch 语句 |
作业自身的方法:SendWelcome(user_id: 7)->dispatch(),带有 delay:、at:、queue: 或 connection:(KScript.Queue) |
download 语句 |
@download(url, to),返回它所保存文件的路径(KScript.Net) |
redirect 语句 |
控制器中的 return @redirect(/thanks)(KScript.Http);页面中的 <respond redirect="/thanks" /> |