我有一个字符串,我想在一定价值之后得到所有东西.该字符串始终以一组数字开头,然后是下划线.我想在下划线后得到其余的字符串.例如,如果我有以下字符串和我想要返回的内容:
"123_String" -> "String"
"233718_This_is_a_string" -> "This_is_a_string"
"83_Another Example" -> "Another Example"
Run Code Online (Sandbox Code Playgroud)
我怎么能做这样的事呢?
我有这样的链接:
<a href="#" onclick="myfunc({a:1, b:'hi'})" />click</a>
<a href="#" onclick="myfunc({a:3, b:'jo'})" />click</a>
Run Code Online (Sandbox Code Playgroud)
我想preventDefault()
在myfunc里面做一个,因为#
点击链接时会在地址栏中添加一个(不做return false;
或不做href='javascript:void(0);'
)
这可能吗 ?我可以在myfunc中获取事件吗?
我想::before
在一些表格单元格上添加一个选择器position:absolute
,但它失败了:
table{ border:1px solid #ccc; padding:10px; }
table td{ border:1px solid #ccc; padding:5px; }
.useBefore::before{
content:'before';
position:absolute;
}
Run Code Online (Sandbox Code Playgroud)
<table>
<tbody>
<tr>
<td>bird</td>
<td>animal</td>
<td>nature</td>
</tr>
<tr class='useBefore'>
<td>building</td>
<td>robot</td>
<td>city</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我注意到如果我将其添加::before
到所有的那个tr
,那么它的工作原理:
table{
border:1px solid #ccc;
padding:10px;
}
table td{
border:1px solid #ccc;
padding:5px;
}
tr::before{
content:'before';
position:absolute;
}
Run Code Online (Sandbox Code Playgroud)
<table>
<tbody>
<tr>
<td>bird</td>
<td>animal</td>
<td>nature</td>
</tr>
<tr class='useBefore'>
<td>building</td>
<td>robot</td>
<td>city</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
但这不是我想要的,因为我只想在其中一些上添加它.
我正在寻找一种好方法,可以在不使用 ::nth-child 或 JavaScript 的情况下从每行中的每个第一个和最后一个项目中删除左右边距。如果这是不可能的,那么我想下一个最好的方法是在主 flexbox 元素上设置负的左/右外边距,但我不太确定使用width: 100%
. 基本上我想要的是这个 flexbox 的左侧和右侧没有蓝色。
编辑:我将不得不在这里为我自己的问题提供解决方案。我将使用包装器元素的东西放在一起,overflow: hidden
并将 flexbox 设置为width: calc(100% + 5px)
. 事实证明 Internet Explorerbox-sizing: border-box
在 flexbox中不支持,但我在这里找到了一种解决方法。
HTML:
<div id="main">
<div><span>div 1</span></div>
<div><span>div 2</span></div>
<div><span>div 3</span></div>
<div><span>div 4</span></div>
<div><span>div 5</span></div>
<div><span>div 6</span></div>
<div><span>div 7</span></div>
<div><span>div 8</span></div>
<div><span>div 9</span></div>
<div><span>div 10</span></div>
<div><span>div 11</span></div>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS:
<div id="main">
<div><span>div 1</span></div>
<div><span>div 2</span></div>
<div><span>div 3</span></div>
<div><span>div 4</span></div>
<div><span>div 5</span></div>
<div><span>div 6</span></div>
<div><span>div 7</span></div> …
Run Code Online (Sandbox Code Playgroud) 我似乎在文件中找不到该APP_ENV
变量的任何正式列表.env
。在实践中我用local
,dev
,development
,staging
,和production
。而且我觉得这样还行。。。甚至我还看到过其他知名Laravel开发人员使用的一些软件。但是,如果有一个标准,我会更有信心。是否有定义环境名称的PSR标准?也许我缺少一些Laravel文档?