谢谢阅读。
只需知道如何将从 gmtime 中的 sql 表获取的日期时间转换为用户时区中的日期时间。
以下是我的代码,但似乎不起作用..
//WHERE $post_arr[5] is date from sql
$user_date=convert_date_for_user($post_arr[5]);
function convert_date_for_user($date_time){
$user = JFactory::getUser();
$db = JFactory::getDBO();
$timezone=$user->getParam('timezone');
echo $tz_offset;
$user_date = JFactory::getDate($date_time,$timezone);
$user_date_str = $user_date->toUnix(true);
return $user_date_str;
}
Run Code Online (Sandbox Code Playgroud)
它可以转换,但我从上面的代码中得到的时间都是错误的。
根据我的标题,我如何在PHP中刷新Google的recaptcha插件的重新搜索图像.可能吗?
我意识到没有第二次尝试相同图像的插件,所以我的看法是每次用户输入和失败时,我将需要使用jquery刷新图像.
我不想也不需要刷新页面,因为我使用.post来检查验证码输入.
以下是我的Javascript代码.
if($("input[name='recaptcha_response_field']").val().length<=0){
formOkay=0;
alert('Captcha helps prevent Spamming. Captcha Cannot be empty');
return false;
}else{
$.post('/external_scripts/recaptcha-php-1.11/jpost/verification.php',$("form[name='registration']").serialize(),function(data){
if(data==0){
formOkay=0;
alert('Captcha is Wrong');
return false;
}else{
..CARRY ON WITH FORM SUBMISSION
Run Code Online (Sandbox Code Playgroud) 我知道有些帖子已经涉及同一主题.
以下是链接:
我正在尝试将php爆炸功能合并到一个javascript模板中.该插件是我从GitHub下载的blueimp @ https://github.com/blueimp/jQuery-File-Upload/downloads的 jQuery-File-Upload .
以下是我的代码的一部分,我正在尝试执行并使其工作.
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<tr>
<td>
<?php echo "{%=file.name%}"; ?> //{%file.name%} contains a string seperated by underscores
<?php $file_name_long = '{%=file.name%}'; ?>
<?php $file_name = explode ('_' , $file_name_long); ?>
<?php print_r($file_name); ?>
</td>
</tr>
...
...
Run Code Online (Sandbox Code Playgroud)
我能够将$ file_name打印为数组,但是我无法通过file.name中的下划线将其分开.打印的数组按照file.name包含整个字符串.
我不确定这是否可行.我一整天都在努力.如果这不可行或逻辑上不正确,请告诉我,以便我可以停止尝试使这项工作.谢谢和赞赏.
请查看以下代码.我无法将我的价值观加起来.数字只是将其自身添加到字符串的后面.不知道怎么回事.
$("a[name='older_post']").click(function(){
$("div.main_ads_div a[name='older_post']").remove().fadeOut();
var last_td_id=parseInt($("table.main_ads_table:last").find("td.load_ads:last").attr("id"),10);
alert(last_td_id); //OUTPUTS 38
$("div.main_ads_div").append('<table class="main_ads_table" col="7" row="7"><tr><td class="load_ads" id="'+last_td_id+1+'"></td><td class="load_ads" id="'+last_td_id+2+'"></td><td class="load_ads" id="'+last_td_id+3+'"></td><td class="load_ads priority" id="'+last_td_id+4+'"></td><td class="load_ads priority" id="'+last_td_id+5+'"></td><td class="load_ads" id="'+last_td_id+6+'"></td><td class="load_ads" id="'+last_td_id+7+'"></td><td class="load_ads" id="'+last_td_id+8+'"></td></tr></table>');
});
Run Code Online (Sandbox Code Playgroud)
所以我想要到达的是每个td追加的,我想要得到39, 40, 41, 42...但是我得到了诸如381, 382, 383,...等等的价值.
任何帮助在这里赞赏.
所以我只是想知道.为什么这样做:
$("input[name='edit-meta']").keyup(function(e){
if(e.keyCode=='32'||e.keyCode=='13'){
var clicked=$(this);
var tag=$(this).val();
clicked.siblings("#edit-meta").append('<span style="background:<?php echo $ad_details_arr[9]?>;color:<?php echo $ad_details_arr[8]?>" class="tag">'+tag.slice(0,-1)+'<a href="#" class="remove" style="background:<?php echo $ad_details_arr[10]?>;color:<?php echo $ad_details_arr[8]?>;margin:5px">x</a></span>');
clicked.val("");
}
$("a.remove").on("click",function(e){
e.preventDefault();
var clicked=$(this);
clicked.closest("span.tag").fadeOut(function(){
$(this).remove();
});
});
});
Run Code Online (Sandbox Code Playgroud)
而不是这个:
$("input[name='edit-meta']").keyup(function(e){
if(e.keyCode=='32'||e.keyCode=='13'){
var clicked=$(this);
var tag=$(this).val();
clicked.siblings("#edit-meta").append('<span style="background:<?php echo $ad_details_arr[9]?>;color:<?php echo $ad_details_arr[8]?>" class="tag">'+tag.slice(0,-1)+'<a href="#" class="remove" style="background:<?php echo $ad_details_arr[10]?>;color:<?php echo $ad_details_arr[8]?>;margin:5px">x</a></span>');
clicked.val("");
}
});
$("a.remove").on("click",function(e){
e.preventDefault();
var clicked=$(this);
clicked.closest("span.tag").fadeOut(function(){
$(this).remove();
});
});
Run Code Online (Sandbox Code Playgroud)
我认为.on足以让我执行像.live那样创建的处理程序.
也在jquery .on页面中说明.
"......处理尚未创建的后代元素上的事件的能力"