我会使用thymeleaf 3模板引擎来包含外部/远程片段.
今天我正在尝试遵循语法
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<title>Thymeleaf test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
<div th:insert="http://localhost:5001/"></div>
<div th:insert="http://localhost:5002/"></div>
<div th:insert="http://localhost:5003/"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是有效的,但如果每个端口的每个服务花费2秒钟来响应,模板将至少在2 + 2 + 2 = 6秒后生成.
而我正在寻找更多异步/并行的东西,其中模板生成将是MAX(2,2,2)= 2秒(+/-生成其他东西的时间).
我没有找到任何内置的方法,但是如果你有任何关于我应该从哪里开始以及怎么做的话,我不会接近延长Thymeleaf 3.
PS:我知道有DataDriven功能,但我不是在寻找注入数据的异步方式,它实际上是处理模板的异步方式!
我正在编写一个新项目的文档 Sphinx
但是因为这个项目是新的,它的名字可能会改变,我不想在我的所有文档中替换所有"项目名称"的引用.
所以我想知道是否有办法将一些变量/常量放在上面Sphinx.
我知道有一个i18n功能Sphinx,所以我可以使用gettext更改"项目名称"而不需要其他任何东西.但我正在寻找一种正确的方法来做到这一点.
我正在使用gmaps apiv3 webservice与latlng couple进行地理编码.这很简单,但我对某些数据有一种奇怪的行为.
公式:
http://maps.googleapis.com/maps/api/geocode/xml?sensor=false®ion=fr&latlng=46.16141,-1.149797
接下来我用导航器(firefox/chrome)打开url,并在行中formatted_address输入值为:
<formatted_address>57-79 Rue des Merciers, 17000 La Rochelle, France</formatted_address>
Run Code Online (Sandbox Code Playgroud)
但是当我通过PHP获取xml文件时
$xml = simplexml_load_file($url);
var_dump($xml)
Run Code Online (Sandbox Code Playgroud)
结果:
public 'formatted_address' => string '57-79 Rue des Merciers, 17000 Rochelle, France' (length=46)
Run Code Online (Sandbox Code Playgroud)
在'罗谢尔'之前的'La'这个词刚刚消失......那是我的问题.而且这不是一个独特的案例(我可以发布更多例子).
我也尝试用file_get_contents, curl, wget...相同的结果
我正在寻找纯SQL(或MySQL)语法,我不知道是否可能我会创建一个PHP脚本,但...
我有一个基本表,其中包含一个主键:ID和somes列.我不依赖别人的表格.
目前我的行看起来像:
ID Column1 Column2
22 test test
26 test2 test2
33 test3 test3
...
Run Code Online (Sandbox Code Playgroud)
现在我想重新生成我的所有ID以保持秩序.示例:我从22开始设置
ID Column1 Column2
22 test test
23 test2 test2
24 test3 test3
...
Run Code Online (Sandbox Code Playgroud)