我有以下设置:
在我有的路线:
Route :: get('articles','ArticlesController @ index');
控制器中的索引方法很简单:
public function index()
{
$articles = Article::all();
return View('articles.index', compact('articles'));
}
Run Code Online (Sandbox Code Playgroud)
并在视图中:
@extends('../app')
@section('content')
<h1>Articles</h1>
<p>
@foreach($articles as $article)
<article>
<h2><a href="{{action('ArticlesController@show', [$article->id])}}">{{$article->title}}</a></h2>
<p>{{ $article->body }}</p>
</article>
@endforeach
</p>
@stop
Run Code Online (Sandbox Code Playgroud)
我试图取代:
$articles = Article::all();
Run Code Online (Sandbox Code Playgroud)
同
$article = Article::latest()->get();
Run Code Online (Sandbox Code Playgroud)
这样我才能真正展示最新的文章.我收到了错误:
FatalErrorException in Str.php line 322:
Maximum execution time of 30 seconds exceeded
Run Code Online (Sandbox Code Playgroud)
并且调用堆栈是:
in Str.php line 322
at FatalErrorException->__construct() in HandleExceptions.php line 131
at HandleExceptions->fatalExceptionFromError() in HandleExceptions.php line 116
at HandleExceptions->handleShutdown() in HandleExceptions.php …Run Code Online (Sandbox Code Playgroud) Google Chrome DevTools网络标签是否有任何快捷键组合来清除日志?例如Ctrl+ L用于清除控制台日志.
我希望第一个div与右边对齐,如果我使用float右边它会将第二个div放在我不想要的同一行上,我的目的是让第一个div对齐到右边而不会丢失它的块级别在聊天应用程序中 任何帮助将不胜感激..谢谢
注意:我使用display inline-block只是因为我希望div符合内容.
.outer{
display: block;
}
.lbubble , .rbubble {
position: relative;
padding: 5px;
-webkit-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 2px 2px 10px 0px #616161;
box-shadow: 2px 2px 7px 0px #616161;
display: inline-block;
margin-bottom: 8px;
}
.lbubble{
background: lightblue;
}
.rbubble{
background: lightgreen;
}
.lbubble:after {
content: "";
position: absolute;
top: 5px;
left: -8px;
border-style: solid;
border-width: 10px 14px 10px 0;
border-color: transparent lightblue;
width: 0;
z-index: 1;
}
.rbubble:after {
content: "";
position: absolute;
top: 5px; …Run Code Online (Sandbox Code Playgroud)我有以下代码,其中我将标记花括号之间的内容SpannableString和删除花括号但它给出错误的结果.
String text = "the {quic}k brown {fox} jumps {over} the lazy dog. {A Quick} {brow}nfoxjumpsoverthelazydog";
tv.setText(makeSpannable(text, "\\{.*?\\}"));
public SpannableStringBuilder makeSpannable(String text, String regex) {
SpannableStringBuilder spannable = new SpannableStringBuilder(text);
Pattern pattern = Pattern.compile(regex);
Matcher matcher = pattern.matcher(spannable.toString());
while (matcher.find()) {
String word = matcher.group();
String abbr = word.toString().substring(1, word.length() - 1);
spannable.setSpan(new ForegroundColorSpan(Color.RED), matcher.start(), matcher.end(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
spannable.replace(matcher.start(), matcher.start() + abbr.length() , abbr);
}
return spannable;
}
Run Code Online (Sandbox Code Playgroud)
输入:
the {quic}k brown {fox} jumps {over} the lazy dog. {A …Run Code Online (Sandbox Code Playgroud) 以下字符串st仅包含18个字符,但是当我打印它的长度时,它显示36个字符两次.
String st = "";
System.out.println(st.length());
Run Code Online (Sandbox Code Playgroud)
注意:该字符串包含我将在聊天应用程序中使用的符号,长度可能因16位和8位字符而异,但我对此很模糊.
以下是我的代码。一切安好。我可以加载远程页面。我可以放置 HTML 内容,但我的img标签显示X符号,表示它无法加载图像。
注意:我的图像与JavaFXSmiley 文件夹中的类位于同一个包中,我可以列出所有图像,这意味着路径没有问题。
import java.awt.BorderLayout;
import java.io.File;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.web.WebEngine;
import javafx.scene.web.WebView;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
public class JavaFX {
static WebView webView;
static WebEngine webEngine;
static String imgs = "";
public JavaFX() {
File f = new File(getClass().getResource("/Smiley").getFile());
for (File fs : f.listFiles()) {
imgs += "<img src=\""+fs+"\" width='50' />";
}
System.out.println(imgs);
}
private void initAndShowGUI() {
// This method is invoked on …Run Code Online (Sandbox Code Playgroud) 我有这样的路线:
Route::group(['prefix'=>'admin'],function(){
Route::resource('users','UserController'); // <-- what is the name of this route
});
Run Code Online (Sandbox Code Playgroud)
如何users通过名称来说明路线?我测试了route('users'),users但没有帮助.
我正在使用聊天应用程序,我正在使用JTextPane来显示对话,我想在左边插入发件人的消息,在JTextPane的右边插入接收者的消息,我将文本包装在另一个看起来像一个JTextPane的JTextPane中气球.我只能将信息插入左侧,但不能插入右侧!任何建议都会有所帮助和赞赏.您可以从提供的图像中获取创意.谢谢
注意:这个问题不重复,它与组件有关,不是文本对齐或重力!

在第一个例子我用background-color改变的背景色navbar来orangered,但它不工作,在接下来的例子我只用background改变颜色,现在是工作,什么是这种现象的原因是什么?
第一个例子
@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css");
@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css");
.navbar{
background-color: orangered;
color: white;
line-height: 50px;
}Run Code Online (Sandbox Code Playgroud)
<div class="navbar navbar-inverse">
"background-color: orangered;" is not working.
</div>Run Code Online (Sandbox Code Playgroud)
下一个例子
@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css");
@import url("https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css");
.navbar{
background: orangered;
color: white;
line-height: 50px;
}Run Code Online (Sandbox Code Playgroud)
<div class="navbar navbar-inverse">
"background: orangered;" is working.
</div>Run Code Online (Sandbox Code Playgroud)