我使用嵌套计数器和范围来创建有序列表:
ol {
counter-reset: item;
padding-left: 10px;
}
li {
display: block
}
li:before {
content: counters(item, ".") " ";
counter-increment: item
}Run Code Online (Sandbox Code Playgroud)
<ol>
<li>one</li>
<li>two</li>
<ol>
<li>two.one</li>
<li>two.two</li>
<li>two.three</li>
</ol>
<li>three</li>
<ol>
<li>three.one</li>
<li>three.two</li>
<ol>
<li>three.two.one</li>
<li>three.two.two</li>
</ol>
</ol>
<li>four</li>
</ol>Run Code Online (Sandbox Code Playgroud)
我期待以下结果:
1. one
2. two
2.1. two.one
2.2. two.two
2.3. two.three
3. three
3.1 three.one
3.2 three.two
3.2.1 three.two.one
3.2.2 three.two.two
4. four
Run Code Online (Sandbox Code Playgroud)
相反,这就是我所看到的(错误的编号):
1. one
2. two
2.1. two.one
2.2. two.two
2.3. two.three
2.4 three …Run Code Online (Sandbox Code Playgroud) 我有以下代码:
<?
$query =$db->prepare("INSERT INTO a_table (id, a_field) VALUES ('', (:a_field)");
$query->bindParam(":a_field", $a_value);
$query->execute();
$last_id = $db->lastInsertId('a_table');
?>
Run Code Online (Sandbox Code Playgroud)
我想问的是这个.想象一下,当两个人在同一时间加载页面时,在检索到最后一个ID之前插入其他人查询是否可能存在危险,混合ID?
使用ini_set(),我可以扩展脚本的最大执行时间.在Symfony2中,我可以添加ini_set到web/app.php和web/app_dev.php增加的执行时间应用到所有控制器.
但在这种情况下,我只想扩展Symfony2中一个特定控制器操作的最长执行时间.我宁愿不让其他行动的可能性超过必要的时间.
我尝试ini_set在控制器的动作功能顶部添加,但这似乎不起作用.有解决方案吗 谢谢!
我制作了一个简单的脚本,允许用户使用向上和向下按钮对div进行排序.
jsFiddle:http://jsfiddle.net/dZ6rC/5/
不幸的是,我尝试在鼠标单击时动画移动不会导致移动标记.
这是我的代码:
$('.up').click(function(){
var previous = $(this).parent().parent().prev('.item');
$(this).parent().parent().insertBefore(previous).slideUp();
});
$('.down').click(function(){
var next = $(this).parent().parent().next('.item');
$(this).parent().parent().insertAfter(next).slideDown();
});?
Run Code Online (Sandbox Code Playgroud)
有人能弄清楚标签为什么不移动?
我网站的用户可以生成自定义表单.所有字段都保存在具有唯一ID的数据库中.当有人访问表单时,字段'name'属性是字段*ID*,例如
<p>Your favorite band? <input type="text" name="field28"></p>
<p>Your Favorite color? <input type="text" name="field30"></p>
Run Code Online (Sandbox Code Playgroud)
提交表单后,我使用php验证表单,但我不知道检索$ _POST [field28]的值(或该字段有什么数字).
<?
while($field = $query_formfields->fetch(PDO::FETCH_ASSOC))
{
$id = $field[id];
//this doesn't work!!
$user_input = $_POST[field$id];
//validation comes here
}
?>
Run Code Online (Sandbox Code Playgroud)
如果有人可以帮助我,我真的很感激!
我需要比较可以用几种方式编写的名称.例如,圣托马斯这样的名字有时候就像圣托马斯或圣托马斯一样.最好是,我希望建立一个函数,给出比较的"平等"百分比,就像某些论坛一样(例如,这篇文章是5%编辑的).
下面的 preg_match 将“空”(0 个字符)与通配符进行匹配。我想禁用它:
preg_match('/site.com\/subsection\/.*?/', $page_url);
Run Code Online (Sandbox Code Playgroud)
所以上面的内容应该匹配 site.com/subsection/subpage,但不应该匹配根目录 site.com/subsection/
如何调整上面的正则表达式?提前致谢!