Phoenix Framework 是 Elixir 语言的一个 Web 应用开发框架。示例代码:
defmodule Controllers.Pages do use Phoenix.Controller def show(conn) do if conn.params["page"] in ["admin"] do redirect conn, Router.page_path(page: "unauthorized") else text conn, "Showing page #{conn.params["page"]}" end end end defmodule Controllers.Users do use Phoenix.Controller def show(conn) do text conn, "Showing user #{conn.params["id"]}" end def index(conn) do html conn, """ <html> <body> <h1>Users</h1> </body> </html> """ end end