我正在尝试通过 Laravel Validation 来验证日期时间,如下所示:
$this->validate($request,[
'DateTime'=> 'required|after_or_equal:' . date('Y-m-d H:i:s'),
]);
Run Code Online (Sandbox Code Playgroud)
如果用户输入的日期时间大于当前日期时间,我想限制用户,但在我的情况下,日期正在验证,但我也必须验证时间。日期时间的格式是2020-12-23 17:40:00
我想查看谷歌选择器中的所有文件,因为我正在关注此链接:
但它返回API开发人员密钥无效.
我的代码如下,但该密钥在其他项目中正常工作:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<title>Google Picker Example</title>
<script type="text/javascript">
// The Browser API key obtained from the Google Developers Console.
// Replace with your own Browser API key, or your own key.
var developerKey = 'AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXM';
// The Client ID obtained from the Google Developers Console. Replace with your own Client ID.
var clientId = "XXXXXXXXXXXX-XXXXXXXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com"
// Replace with your own App ID. (Its the first number in your Client ID) …Run Code Online (Sandbox Code Playgroud) 我想在选择文件或文件更改时调用onchange函数,但是我的onchange函数没有被调用,因为我已经设置了display:none用于文件控制,因为我在图像点击时使用调用它,我无法理解在onchange函数上调用它:
$(document).ready(function() {
$('#profile-image').on('click', function() {
$('#photo').click(); // opens up the file dialog for selection of image
});
});
$("#photo").change(function() {
alert($(this).val())
});Run Code Online (Sandbox Code Playgroud)
.hidden_img {
display: none;
}Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<input class="hidden_img" type="file" name="imagefile" id="photo"/>
<img src="images/btn.jpg" width="148" height="60" alt="btn" id="profile-image">Run Code Online (Sandbox Code Playgroud)
我正在使用Google云端硬盘文件选择器示例演示项目处理Google云端硬盘文件选择器.我已生成API密钥和客户端ID.但是当我运行项目时,我得到了以下错误
- 那是一个错误.
错误:invalid_client
找不到OAuth客户端.
我还检查了此Google云端硬盘文件选择器示例链接,但它不起作用,请帮我解决我的问题.
我想知道方法名称后冒号的含义即
公共函数 getTitle():Data {
interface Data {
public function details(string $name);
}
class Company {
private $title;
public function getTitle():Data {
return $this->title;
}
public function setTitle(Data $title)
{
$this->title=$title
}
}
.....
.....
Run Code Online (Sandbox Code Playgroud) 我想在单击引导分页链接时调用 jquery 函数。
假设我想从第1页遍历到第2页,应该调用一个jquery函数。
我正在使用以下代码,但它不起作用:
$("ul.pagination").on("click","li", function(){
alert("page changed");
});
Run Code Online (Sandbox Code Playgroud)
我正在尝试在 Laravel 中使用 sendgrid 发送邮件,但它正在本地服务器上运行,但当我将其托管在服务器上时,它给了我以下错误消息:
我在 .env 文件中的邮件设置:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.sendgrid.net
MAIL_PORT=587
MAIL_USERNAME=myusername
MAIL_PASSWORD=XXX
MAIL_ENCRYPTION=tls
MAIL_FROM_ADDRESS=info@xyz.com
MAIL_FROM_NAME=xyz
Run Code Online (Sandbox Code Playgroud) 我想验证文本字段,尝试下面的代码:
<input v-validate="result.val=='Required' ? 'required' : ''" v-model="required" :name="f_name" type="text"/>
Run Code Online (Sandbox Code Playgroud)
但出现此错误:
app.js:48089 [Vue warn]: 无法解析指令:验证
尝试这个:
<ValidationProvider name="phone" :rules="required" v-slot="{ errors }">
<input class="form-control" :name="phone" type="text" v-model="form.phone"/>
</ValidationProvider>
Run Code Online (Sandbox Code Playgroud) 我正在尝试验证表单中的字段并使用唯一的规则
$validator = Validator::make($request->all(),[
'email' => ['required', 'string', 'email', 'max:255', Rule::unique('users')->where(function ($q) {
$q->whereNotNull('password');
}) ],
'password' => ['required', 'string', 'min:5', 'confirmed','min:8'],
'password_confirmation' => ['min:8']
]);
Run Code Online (Sandbox Code Playgroud)
收到此错误:
message: "调用未定义的方法 Illuminate\Contracts\Validation\Rule::unique()",
使用了这个命名空间:
使用 Illuminate\Contracts\Validation\Rule;
有什么建议请谢谢
我想使用jquery ajax将图像上传到本地文件夹.复杂的部分是我有动态生成的表单,以及我给它的id的那些表单和字段,以便显示提交的表单,如下所示.我正在使用以下代码,但图片未上传.
查看:Upload_View.php
<script type="text/javascript">
function sendVideoData(frm_id)
{
var data = new FormData(document.getElementById("post_video_"+frm_id));
// make the AJAX request
jQuery.ajax({
type: "POST",
url: "<?php echo base_url(); ?>"+"dashboard/do_upload",
data: data+'&form_id='+frm_id,
mimeType:"multipart/form-data",
contentType: false,
cache: false,
processData:false,
dataType: 'json',
success: function (data) {
alert("data"+data);
},
});
return false;
}
</script>
<form name="post_video" id="post_video_<?=$row1['id']?>" method="post" onsubmit="return sendVideoData(<?=$row1['id']?>)">
<input type="file" name="save_movie_<?=$row1['id']?>" id="movie_<?=$row1['id']?>" />
<input name="type_lecture_id" class="get_lecture_id" id="get_lecture_id_<?=$row1['id']?>" value="<?=$row1['id']?>" type="hidden"/>
<input type="button" class="postbtn" id="submit_movie_<?=$row1['id']?>" value="Upload Video File"/>
</form>
Run Code Online (Sandbox Code Playgroud)
控制器:
$formid=$_POST['form_id'];
$filename='save_movie_'.$formid;
$path_parts = pathinfo($_FILES[$filename]["name"]);
$extension = …Run Code Online (Sandbox Code Playgroud) I have created a dropdown which contains Job Positions. I want to disable the dropdown item which user has previously applied. Here to reduce my code i have created options_selected static to get selected job profile lists. Here $job_positions contains all job profiles and $options_selected contains all the items which he previously selected from job_positions. Now he can't select these options again these should be disabled.
$job_positions =array('0' => 'Select', '1' => 'IT Staff', '2' => 'Customer Care', '3' => …Run Code Online (Sandbox Code Playgroud) 我想在发生错误时显示div并在一切正常时隐藏但是div没有隐藏并显示JavaScript.
我的代码如下:
<script>
function hideerror() {
var catdiv = document.getElementById(error);
catdiv.style.display = "none";
}
</script>
<div class="form-item">
<div id="error" class="hideerror" style="color:#F00">
error occured
</div>
</div>
<?php
echo '<script type="text/javascript"> hideerror(); </script>';
?>
Run Code Online (Sandbox Code Playgroud) php ×5
javascript ×4
jquery ×4
html ×3
laravel ×3
codeigniter ×2
google-oauth ×2
laravel-5 ×2
ajax ×1
css ×1
laravel-7 ×1
oauth ×1
oauth-2.0 ×1
oop ×1
pagination ×1
sendgrid ×1
vee-validate ×1
vue.js ×1
vuejs2 ×1