我使用validate.jquery.js:工作正常.但是当我添加selected.js时,对选择下拉列表的验证不再有效.
这是JS我正在使用http://pastebin.com/S9AaxdEN
这是我的选择形式:
<select name="category" id="category" placeholder="" class="{validate:{required:true}}">
<option value=""><?php echo lang('category_choice'); ?></option>
<option value="vtt">VTT</option>
<option value="autre">Autre type de vélo</option>
</select>
Run Code Online (Sandbox Code Playgroud)
不知道为什么choose.js禁用验证,任何想法?
当浏览我的网站与谷歌浏览器的最新版本,并使用F12寻找到的来源,所有的内容之间<head>,并</head>显示为空.在最新版本的Firefox和IE上,一切都是正确的.
实际上,内容会在Google Chrome上移动到正文中.
这显然不是CSS问题.我正在使用Twitter Bootstrap CSS和JS,以及一个MVC PHP框架.有人有提示吗?
这是我的document.html页面:
<!DOCTYPE html>
<html lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title><?php echo (Template::$titre); ?></title>
<?php foreach(Template::$meta as $key=>$value): ?>
<meta name="<?php echo $key; ?>" content="<?php echo $value; ?>" />
<?php endforeach; ?>
<link rel="shortcut icon" href="<?php echo WEB; ?>assets/style/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" href="<?php echo WEB; ?>assets/style/bootstrap.min.css" />
<link rel="stylesheet" href="<?php echo WEB; ?>assets/style/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="<?php echo WEB; …Run Code Online (Sandbox Code Playgroud) 我正在使用Twitter引导程序,CSS和JS.
问题来自Modal插件,它在Firefox和IE上运行良好但在Chrome中显示不好:模式成功弹出,但在模态背景后面因此无法使用表单(包含在模式框中)
您可以点击右上角的按钮试试:http://
它在bootstrap示例页面(http://twitter.github.com/bootstrap/javascript.html#modals)上工作正常,所以我猜它来自我的CSS
我到处都看,但找不到任何可疑的东西.我错过了什么?
我想为Laravel 5.2创建一个cron作业
我的共享主机(在OVH上)只允许我指向文件的完整路径,而且我无法使用Laravel文档中推荐的Cron条目,即:
* * * * * php /path/to/artisan schedule:run >> /dev/null 2>&1
Run Code Online (Sandbox Code Playgroud)
因此,我必须从Laravel框架之外的.php文件中调用Artisan命令.
这是我的public/cron.php文件到目前为止的样子:
<?php
require __DIR__.'/../bootstrap/autoload.php';
use Illuminate\Support\Facades\Artisan;
Artisan::call('refresh');
Run Code Online (Sandbox Code Playgroud)
refresh 是我在我的应用程序内重新生成缩略图的命令.
通过我的浏览器访问cron.php(在本地XAMPP上测试)时,会发生以下错误:
Fatal error: Uncaught RuntimeException: A facade root has not been set. in
C:\xampp\htdocs\site\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php:210
Stack trace:
#0 C:\xampp\htdocs\site\public\cron.php(7): Illuminate\Support\Facades\Facade::__callStatic('call', Array)
#1 {main} thrown in C:\xampp\htdocs\site\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php on line 210
Run Code Online (Sandbox Code Playgroud)
我也尝试启动应用程序,但它没有任何区别
$app = require_once __DIR__.'/../bootstrap/app.php';
$app->boot();
Run Code Online (Sandbox Code Playgroud)
为了避免使用Artisan Facade,我尝试直接调用底层内核类:
use Illuminate\Contracts\Console\Kernel;
$kernel = new Kernel;
$kernel->call('refresh');
Run Code Online (Sandbox Code Playgroud)
但这回归:
Uncaught Error: Cannot instantiate interface Illuminate\Contracts\Console\Kernel
Run Code Online (Sandbox Code Playgroud)
编辑:这是OVH cron界面的截图.cron任务由OVH定制,只允许指向文件的完整路径uri …
我正在使用Laravel 4.
我愿意显示一个文本,只有我的请求包含否 input
例如,我有一个产品列表mysite/products,我有一个输入字段按价格过滤,一旦点击就会显示以下网址:mysite/products?price=true
我可以if(Input::has('price'))用来检查我是否有这个输入,但问题是我有一堆输入字段,我想只在没有输入时显示文本.
我想的是:
@if(Input::has('price')||Input::has('mixed')||Input::has('male')||Input::has('female')||Input::has('kid')||Input::has('page'))
//Do nothing
@else
//Display my text here
@endif
Run Code Online (Sandbox Code Playgroud)
但是以简化的方式......
我正在考虑检查URi Request::segment(1)并查看它是否匹配,'products'但即使输入处于活动状态也是如此.
Laravel 5.5 中新Route::redirect引入的功能很实用,但是是否允许{any}通配符?
这是我以前在 Laravel 5.4 中所做的
Route::get('slug', function () {
return redirect('new-slug', 301);
});
Run Code Online (Sandbox Code Playgroud)
在 Laravel 5.5 中,我可以执行以下操作:
Route::redirect('slug', url('new-slug'), 301);
Run Code Online (Sandbox Code Playgroud)
这允许通过摆脱闭包来缓存路由。
到目前为止一切顺利,但是如果我想使用通配符怎么办?在 Laravel 5.4 中,我可以这样做:
Route::get('slug/{any}', function ($any) {
return redirect('new-slug/'.$any, 301);
});
Run Code Online (Sandbox Code Playgroud)
当然,我仍然可以在 Laravel 5.5 中使用它,但我的观点是能够缓存我的路由文件。
新版本是否Route::redirect允许使用通配符,或者是我使用控制器的唯一选择?
编辑:我想做的是这样的:
Route::redirect('slug/{any}', url('new-slug/'.$any), 301);
Run Code Online (Sandbox Code Playgroud)
这当然不起作用,因为我不知道在哪里引用该$any变量。
我有一张events桌子和一张tickets桌子。我正在尝试regular_atendies通过订购的门票来减少可用门票,对于vip
这是我的存储方法:
// 创建票证
$ticket = new Ticket();
$ticket->userName = $request->input('userName');
$ticket->userEmail = $request->input('userEmail');
$ticket->phoneNumber = $request->input('phoneNumber');
$ticket->regular_quantity = $request->input('regular_quantity');
$ticket->vip_quantity = $request->input('vip_quantity');
$ticket->event_id = $request->route('id');
$ticket->total = $request->input('regular_quantity') + $request->input('vip_quantity');
$event = Event::find(1);
$event = Event::where('id',$ticket->event_id);
if ($ticket->regular_quantity<$event->regular_attendies) {
DB::table('events')->decrement('regular_attendies', $ticket->regular_quantity);
} elseif ($ticket->vip_quantity<$event->$vip_attendies) {
DB::table('events')->decrement('vip_attendies', $ticket->vip_quantity);
} else {
echo "error";
}
$ticket->save();
return redirect('/');
Run Code Online (Sandbox Code Playgroud) 我想为数字创建一个验证函数,实际上我有那些工作正常,我试图自己创建一个,但不幸的是它没有工作.这是字母数字和其他正常工作:
// Validators
private function custom($validator, $value)
{
return call_user_func($validator, $value, $this->request, $this->id);
}
private function alphanumeric($value, $custom)
{
return preg_match('/^(['.$custom.'a-z0-9_]*)$/i', $value);
}
private function valid_email($value)
{
return preg_match('/^\S+@\S+\.\S+$/', $value);
}
Run Code Online (Sandbox Code Playgroud)
我试图通过修改字母数字来创建的那个:
private function numbers_only($value, $custom)
{
return preg_match('/^(['.$custom.'0-9_]*)$/i', $value);
}
Run Code Online (Sandbox Code Playgroud)
这个怎么了?
编辑:我还有一个JS帮助表单,对于字母数字它是:
Form.prototype.alphanumeric = function(value, custom)
{
return !value.replace(new RegExp('['+custom+'a-z0-9_]', 'ig'), '').length;
};
Run Code Online (Sandbox Code Playgroud)
什么是数字JS?
php ×5
laravel ×4
validation ×3
artisan ×1
cron ×1
css ×1
eloquent ×1
html ×1
html-head ×1
javascript ×1
jquery ×1
laravel-5.5 ×1
meta-tags ×1
modal-dialog ×1