我基本上只想得到一个文件的名称,我得到这样的:
$inputPdf = $request->file('input_pdf');
Run Code Online (Sandbox Code Playgroud)
如果我dd($inputPdf)
它打印了我null
.
如果我想重命名我的laravel 5.1项目,最好的解决方案是什么,我只是试图重命名一个,但它没有正常工作得到一些错误.
是否需要采取某些步骤来重命名laravel项目?
我想在我的.blade.php中显示一个数组,但它无法正常工作,所以我的控制器看起来像这样:
class WatchController extends Controller
{
public function index()
{
$watchFolderPath = 'C:\\xampp\\htdocs\\Pro\\rec\\';
$watchFolder = $this->dirToArray($watchFolderPath);
return view('watch.new')->with('watchFolder', $watchFolder);
}
# Get Directories of Path as Array
function dirToArray($dir) {
$result = array();
$cdir = scandir($dir);
foreach ($cdir as $key => $value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$result[$value] = $this->dirToArray($dir . DIRECTORY_SEPARATOR . $value);
}
else
{
$result[] = $value;
}
}
}
return $result;
}
}
Run Code Online (Sandbox Code Playgroud)
在我的刀片中,我只是试着这样称呼它:
{{ $watchFolder }}
Run Code Online (Sandbox Code Playgroud)
但它没有用,我收到以下错误:
htmlentities()期望参数1为字符串,给定数组
编辑:我得到的数组显示目录中包含子文件夹的所有文件夹/文件.(用过dd()) …
我正在尝试安装Visual Studio 2015社区版我安装了~98%,现在程序告诉我:
另一个安装正在进行中,稍后再试...
我不知道如何解决这个问题.
我实际上不想重新启动计算机,因为安装已经花了我超过2天.
我对所有想法持开放态度.
我正在选择 jquery 中的所有输入,如下所示:
$('input').each(function() {
...
});
Run Code Online (Sandbox Code Playgroud)
但是是否可以创建一个例外,例如说选择所有输入,但输入类型隐藏除外。
我知道我可以选择我需要的特定类型的输入,但我认为这看起来不太好
编辑:抱歉打错了例子,我的意思是这样的:
document.forms["product"].getElementsByTagName("input");
Run Code Online (Sandbox Code Playgroud)
除了隐藏
如何正确更改/更新我的迁移,我使用的是 Laravel 5.1。
文档说我应该使用更改来更新列,例如:
$table->string('color', 10)->change();
Run Code Online (Sandbox Code Playgroud)
但是我必须把它放在迁移中的什么地方,我必须使用什么命令来更新一个简单的 php artisan migrate?
到目前为止我试过这个:
public function up()
{
Schema::create('products', function (Blueprint $table)) {
$table->string('color', 5);
});
Schema::table('products', function (Blueprint $table)) {
$table->string('color', 10)->change();
});
}
Run Code Online (Sandbox Code Playgroud)
并使用了这个命令:
php artisan migrate
Run Code Online (Sandbox Code Playgroud)
但它没有改变。
如何在 Ajax 中正确调用 Laravel 路由或控制器?
出现错误并说:
路线 [product/create] 未定义。(查看: C:\xampp\htdocs\laravel\resources\views\jsBlade\logoInput.blade.php) (查看: C:\xampp\htdocs\laravel\resources\views\jsBlade\logoInput.blade.php)
我的路线如下所示:
# Middleware group if user is successfully logged in
Route::group(['middleware' => 'auth'], function ()
{
Route::get('/home', ['as' => 'home', 'uses' => 'PageController@showHome']);
# Product group
Route::group(['prefix' => 'product'], function ()
{
Route::get('/', ['as' => 'indexProduct', 'uses' => 'ProductController@indexProduct']);
Route::get('new', ['as' => 'newProduct', 'uses' => 'ProductController@newProduct']);
Route::get('show/{productID}', ['as' => 'showProduct', 'uses' => 'ProductController@showProduct']);
Route::get('edit/{productID}', ['as' => 'editProduct', 'uses' => 'ProductController@editProduct']);
Route::post('create', ['as' => 'createProduct', 'uses' => 'ProductController@createProduct']);
Route::post('update', …
Run Code Online (Sandbox Code Playgroud)