我想知道php如何实现如下功能设计:
讲座> FUNC() - > FUNC()
这是laravel验证示例.
$validator->after(function($validator)
{
if ($this->somethingElseIsInvalid())
{
**$validator->errors()->add('field', 'Something is wrong with this field!');**
}
});
Run Code Online (Sandbox Code Playgroud)
after()在这里做了神奇的工作吗?
以及如何创建自己的代码,可以像这样.
单击联系人,简历,资源链接将需要更新某些功能,例如[ http://webonise.co.uk/] [1 ](位置URL和div内容),但无需刷新页面。
@app.route('/')
def index():
flash('Welcome')
return render_template('index.html')
Run Code Online (Sandbox Code Playgroud)
在index.html下是base.html的扩展
{% block content %}
{{super()}}
<section class="content">
<a href="#"><i class="mdi-event"></i>Event</a>
<a href="#"><i class="mdi-contact"></i>Contact</a>
<div class="board">
{# dynamic template #}
{# without using {{% include 'event.html' %}} #}
</div>
</section>
{%- endblock %}
Run Code Online (Sandbox Code Playgroud)
在{#动态模板#}下单击不同的链接和rendar时,如何刷新rendar event.html / contact.html内容而不刷新页面?
<!--event.html-->
<ul class="list">
<li>
<h3>123</h3>
<p>abc</p>
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
导入jinja2环境,但仍然不知道如何实现这一目标
env = Environment(autoescape=True,
loader=FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')))
@app.route('/')
def index():
board = env.get_template('event.html')
flash('Welcome Home Tyler') …Run Code Online (Sandbox Code Playgroud)