我正在使用Boostrap框架,但我对手风琴有问题.当我试图在同一页面上添加2个bootstrap手风琴http://twitter.github.com/bootstrap/javascript.html#collapse时,只有一个可以正常工作.有人如何在同一页面上添加2个这些手风琴?
感谢你的时间.
我想知道应该使用哪种方法将数据存储在数据库中。
第一种方法
$product = Product::create($request->all());
Run Code Online (Sandbox Code Playgroud)
在我的产品模型中,我有用于批量分配的$ filable数组
第二种方法
$product = new Product();
$product->title = $request->title;
$product->category = $request->category;
$product->save();
Run Code Online (Sandbox Code Playgroud)
这两个“更好的解决方案”中的任何一个吗?我通常应该使用什么?
谢谢你的建议
我正在尝试使用Laravel 5.0创建应用程序,我在BaseController构造函数中使用Session方法时遇到问题
这是我的BaseController和它的consturctor.
use Symfony\Component\HttpFoundation\Session\Session;
class BaseController extends Controller {
/**
* Initializer.
*
* @access public
* @return \BaseController
*/
public function __construct()
{
//set default lang
if (!Session::has('lang')) {
Session::put('lang', App::getLocale());
Cookie::forever('lang', App::getLocale());
} else {
App::setLocale(Session::get('lang'));
}
}
}
Run Code Online (Sandbox Code Playgroud)
但是我得到了这个错误
BaseController.php第22行中的ContextErrorException:运行时注意:非静态方法Symfony\Component\HttpFoundation\Session\Session :: has()不应该静态调用,假设$ this来自不兼容的上下文
有谁知道我做错了什么?
我有这个AJAX功能
type: "GET",
url: url,
cache: false,
dataType: 'html',
success: function(data){
},
error: function(){ },
complete: function(){ }
});
Run Code Online (Sandbox Code Playgroud)
当然,"数据"代表整个文档,<html>
但我只想从这个数据变量中获取body元素的类.
有谁知道这是怎么做到的吗?从检索到的数据中获取body元素类?
非常感谢你的每一个建议.
我正在尝试从网站 www.pornhub.com 获取 HTML 内容(不要问为什么:D)但经典
file_get_contents('http://www.pornhub.com');
Run Code Online (Sandbox Code Playgroud)
不起作用。我也试过
$Url = 'https://www.pornhub.com/categories';
if (!function_exists('curl_init')){
die('CURL is not installed!');
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $Url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
curl_close($ch);
return $output;
Run Code Online (Sandbox Code Playgroud)
但它也不起作用。
有谁知道我做错了什么?
感谢您的帮助。