我正在使用recaptcha和我的laravel应用程序.
我只是想使用jquery检查recaptcha对表单提交的响应,并通过提醒验证验证码的警告来停止用户.
但是,即使没有填写验证码,我也无法停止表单提交.
这是我的代码.
$('#payuForm').on('submit', function (e) {
var response = grecaptcha.getResponse();
if(response.length == 0 || response == '' || response ===false ) {
alert('Please validate captcha.');
e.preventDefault();
}
});
<div class="captcha">
{{ View::make('recaptcha::display') }}
</div>
Run Code Online (Sandbox Code Playgroud)
我在浏览器控制台中收到此错误,表单将被提交.
Error: ReCAPTCHA placeholder element must be empty
Run Code Online (Sandbox Code Playgroud) 可能重复:
在JavaScript中获取查询字符串值
如何在javascript中获取get变量?
我想在jquery函数中传递它.
function updateTabs(){
//var number=$_GET['number']; how can i do this?
alert(number);
$( "#tabs" ).tabs({ selected: number });
}
Run Code Online (Sandbox Code Playgroud) 我试图提取字符串的初始字符.在PHP中我需要一些帮助.
以下是我正在使用的一些示例字符串以及我需要的结果:
$String="Progress in Veterinary Science";
Run Code Online (Sandbox Code Playgroud)
输出将是
// PIVS
Run Code Online (Sandbox Code Playgroud)
感谢名单!
我有以下代码
// load image and get image size
$img = imagecreatefrompng( "{$pathToImages}{$fname}" );
$width = imagesx( $img );
$height = imagesy( $img );
// calculate thumbnail size
$new_width = $imageWidth;
$new_height = 500;
// create a new temporary image
$tmp_img = imagecreatetruecolor( $new_width, $new_height );
// copy and resize old image into new image
imagecopyresized( $tmp_img, $img, 0, 0, 0, 0, $new_width, $new_height, $width, $height );
Run Code Online (Sandbox Code Playgroud)
它在某些图像上可以正常工作..但是在某些图像上却显示错误
Warning: imagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpeg: JPEG library reports unrecoverable error:
Warning: imagesx() expects parameter …Run Code Online (Sandbox Code Playgroud) 我想在ftp上传文件.
这是我的代码
$jname= "Accounts of Biotechnology Research";
if (!is_dir('/Trade/upload/ '.$jname)) {
mkdir('/Trade/upload/ '.$jname); // line 63
}
move_uploaded_file($_FILES["submission_file"]["tmp_name"], "/Trade/upload/$jname/" . $dup_name ); // line 67
Run Code Online (Sandbox Code Playgroud)
Trade是public_html文件夹中的一个文件夹.
当我上传文件时,它会给我一个警告,比如
Warning: mkdir() [function.mkdir]: No such file or directory in /home/my_username/public_html/Trade/upload.php on line 63
Warning: move_uploaded_file(/Trade/upload/Accounts of Biotechnology Research/76164762-sm.pdf) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/my_username/public_html/Trade/upload.php on line 67
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phphZXp0O' to '/Trade/upload/Accounts of Biotechnology Research/76164762-sm.pdf' in /home/my_username/public_html/Trade/upload.php on line 67
Run Code Online (Sandbox Code Playgroud) 我想用字符串下标每个数字。
例如 :
$str = '1Department of Chemistry, College of 2Education for Pure Science';
Run Code Online (Sandbox Code Playgroud)
我想要的输出:
<sub>1</sub>Department of Chemistry, College of <sub>2<sub>Education for Pure Science
Run Code Online (Sandbox Code Playgroud)
我从一个字符串中提取了所有数字:
//digits from string
preg_match_all('!\d+!', $str, $matches);
print_r($matches);
Run Code Online (Sandbox Code Playgroud)
但是,如何将下标效果应用于数字和打印字符串?
我正在对提交按钮单击事件进行 ajax 调用以检查字段验证服务器端。当我验证失败时,ajax 响应会给出正确的错误消息,返回 false,并停止表单提交到操作 url。但是当我收到“成功”的响应时,表单仍然没有提交到操作 url 脚本。
在ajax响应之前执行return语句是这种情况吗?
还有为什么没有提交表单?
这是代码:
<input type="submit" onclick="return validate();" name="submit" value="Proceed" />
<script type="text/javascript">
var flag=false;
function validate(){
$.ajax({
type:"POST",
url:"../chk.php",
data:datastring,
cache: false,
success: function (result) {
if(result.toString() == "success" ){
flag=true;
}
else{
$('#error').css('display', 'block');
$('#error').css('color','red');
$('#error').text(result.toString());
flag=false;
}
}
});
return flag;
}
</script>
Run Code Online (Sandbox Code Playgroud) 我有一个使用 React js 构建的项目,我想在本地执行它
到目前为止我所做的:
1)安装node.js(Windows 64位)
2)从https://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm开始执行步骤3
我现在有
1) c://程序文件/nodejs/node_modules
2)桌面/reactApp/node_modules
我将项目文件夹放在reactApp/中。所以package.json位于reactApp/package.json
现在当我尝试跑步时npm start
C:\Users\xxx\Desktop\reactApp>npm start
> liquid@0.1.0 start C:\Users\jitendra\Desktop\reactApp
> PORT=8080 react-scripts start
'PORT' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! liquid@0.1.0 start: `PORT=8080 react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the liquid@0.1.0 start script 'PORT=8080 react-scripts start'.
npm ERR! Make sure you …Run Code Online (Sandbox Code Playgroud) 只是我想将一些字符附加到父窗口的文本区域。
str="some character"
window.opener.document.getElementById('id1').value = str;
Run Code Online (Sandbox Code Playgroud)
它将父窗口的文本区域的值更改为“某个字符”。但我想将此文本附加到文本区域的值中。喜欢,
window.opener.document.getElementById('id1').value.append(str); // not working
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
我怎样才能做到这一点?
我想重定向每个页面(也从子目录)重定向到.php文件.
像abc.html到abc.php,如果abc.php不存在,它应该显示404
这是我的htaccess代码.
RewriteEngine on
RewriteCond %{THE_REQUEST} \ /(.+)\.html
RewriteRule ^ /%1.php [L,R=301]
RewriteRule ^(.*).php$ $1.html [QSA]
Run Code Online (Sandbox Code Playgroud)
它只将一些页面重定向到php,它还重定向到文件夹中不存在的某些php文件.
怎么解决 ?
我对 codeigniter 非常陌生。我有一个 codeigniter 项目,我需要做一些更改。我已将其粘贴到 htdocs 并将 application/config/config.php 的 base_url 更改为 localhost 的路径。
并更改了 application/config/database.php 中的数据库连接
进行上述更改后,我的索引页在 localhost 上打开良好。但索引页中的所有链接都重定向到http://localhost/dashboard/ 。
我没有更改 .htaccess 文件内容。这里是 :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?
php ×8
javascript ×4
.htaccess ×2
file-upload ×2
jquery ×2
ajax ×1
appendchild ×1
codeigniter ×1
file ×1
forms ×1
get ×1
image ×1
json ×1
laravel-4.2 ×1
mysql ×1
node.js ×1
npm ×1
primary-key ×1
reactjs ×1
recaptcha ×1
redirect ×1
regex ×1
string ×1
subscript ×1