Cron作业问题Javascript没有在php LINUX服务器上运行 [英] Cron jobs problem Javascript not running in php LINUX server

查看:81
本文介绍了Cron作业问题Javascript没有在php LINUX服务器上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨......代码在CodeIgniter中......

Cron作业在PHP视图页面中没有执行我的javascript,当我分配控制器功能时,同时我我正在调用View Page(包含Javascript代码),在cron作业完成后javascript没有在View页面中执行请帮忙。



[edit]

嗨这是我在cron工作中调用的函数



 public function connect()
{


$ mail = $ this-> Reports_model_weekly-> get_all_usermails();
$ i = 0;
foreach($ mail as $ email)
{
$ data = array();
$ data [' company_name'] = $ email [' company_name'];
$ data [' company_id'] = $ email [' id'];
$ user = $ email [' customer_name'];
$ email_id = $ email [' email_id'];
$ data [' survey'] = $ this-> Reports_model_weekly-> get_surveys ($ email [' id']);
$ data [' locations'] = $ this-> Reports_model_weekly-> get_locations ($ email [' id']);
$ graph = $ this-> load-> view(' reports / reports_weekly_graphs',$数据);


// print(< div style ='display:none ;'>。print_r($ graph)。< / div>);
$ pdf_data = $ this-> pdf_generate($ email [' id']);
/ * print(< script> alert('<! - ?php print_r($ graph);? - >');< / script>); * /


$ html = $ this-> load-> view (' reports / reports_weekly',$ pdf_data,true);

/ * $ filename = $ data ['company_name'];
$ this-> load-> library('pdf');
$ mpdf = $ this-> pdf-> load();
$ mpdf-> WriteHTML($ html);
$ mpdf->输出($ data ['company_name'],'D');
* /


$ this-> db-> select(' ID );
$ image1 = $ this-> db-> get(' weekly_report_image_url') - > result_array();

foreach($ image1 as $ row)
{
$ id1 = $ row [' id'];
$ this-> db-> delete(' weekly_report_image_url',array(< span class =code-string>'
id' => $ id1));
}
$ this-> load-> library(' email');
$ config = array();
$ config = $ this-> mail_config();
$ config [' mailtype'] = html;
$ this-> email-> initialize($ config);
$ this-> email-> from(' no-Reply@gmail.com');
$ this-> email-> to(' xyz@abc.com' );
$ this-> email-> subject( 每周报告);

$ this-> email-> message($ html);
/ * $ filename = $ email ['company_name'];
$ this-> load-> library('pdf');
$ mpdf = $ this-> pdf-> load();

$ mpdf-> WriteHTML($ html);
// $ mpdf->输出($ pdfFilePath,'F');
$ mpdf->输出($ email ['company_name'],'D');
* /


if($ this-> email-> send())
{
$ data [' success'] = ' < p class =email_sent>已向您发送电子邮件< / p>

< p>如果您还没有收到电子邮件:< / p>
< ul>
< li>请尝试在垃圾邮件框中查看。< / li>
< li>如果仍未找到,您可以尝试再次提交表单以重新发送。< / li>
< li>如果问题仍然存在,请通过< a href =mailto:support@txt.comstyle =text-decoration:none;>< span style =color联系我们:#25a8e0;> support@txt.com<跨度>< / A>< /锂>
< / ul>'
;



// print_r($ data);退出;
}
}



此功能手动无需cron作业...当我将此分配给cron作业时它不会工作..请帮助我

解决方案

mail =


this-> Reports_model_weekly-> get_all_usermails();

I = 0;
foreach(


Hi ...... The code is in CodeIgniter ...
Cron job is not executing my javascript in PHP view page ,when I am assigning controller function and on the same time i am calling View Page(contains Javascript code ) ,after cron job done javascript was not executing in View page please help out .

[edit]
Hi this is a function i am calling in cron job

public function connect()
{


$mail=$this->Reports_model_weekly->get_all_usermails();
$i=0;
foreach($mail as $email)
{
    $data=array();
    $data['company_name']=$email['company_name'];
    $data['company_id']=$email['id'];
    $user=$email['customer_name'];
    $email_id=$email['email_id'];
    $data['surveys']=$this->Reports_model_weekly->get_surveys($email['id']); 
    $data['locations']=$this->Reports_model_weekly->get_locations($email['id']); 
 $graph=$this->load->view('reports/reports_weekly_graphs',$data);


//    print("<div style='display: none;'>".print_r($graph)."</div>" );
    $pdf_data=$this->pdf_generate($email['id']);  
    /*print("<script>alert('<!--?php print_r($graph);?-->');</script>");*/


  $html=$this->load->view('reports/reports_weekly',$pdf_data,true);

/*    $filename=$data['company_name'];
	$this->load->library('pdf');
    $mpdf = $this->pdf->load(); 
$mpdf->WriteHTML($html);
$mpdf->Output($data['company_name'],'D');
*/
  
    $this->db->select('id');
$image1=$this->db->get('weekly_report_image_url')->result_array();
    
    foreach($image1 as $row)
        {
	$id1=$row['id'];
	$this->db->delete('weekly_report_image_url',array('id'=>$id1));
        }
    $this->load->library('email');
    $config = array();
                                        $config = $this->mail_config();
                                        $config['mailtype'] = "html";
                                        $this->email->initialize($config);
                                        $this->email->from('no-Reply@gmail.com');
                                        $this->email->to('xyz@abc.com');
                                        $this->email->subject("Weekly Report");
						
                                        $this->email->message($html);
                                      /*$filename=$email['company_name'];
                                         $this->load->library('pdf');
                                        $mpdf = $this->pdf->load(); 

                                 $mpdf->WriteHTML($html);
                                 //$mpdf->Output($pdfFilePath, 'F');
                                 $mpdf->Output($email['company_name'],'D');
                               */
                                      
				if($this->email->send())
				{
					$data['success'] ='<p class="email_sent">An email has been sent to you </p> 
                    
                    <p>If you have not received the email:</p> 
                    <ul>
                    <li >Please Try to look at it in your spam email box.</li>
                    <li>If it is still not found, you may try to submit the form again to resend it.</li>
                    <li >If the problem persists, please contact us on<a href="mailto:support@txt.com" style="text-decoration:none;"><span style="color:#25a8e0;"> support@txt.com<span></a></li>
                    </ul>';                        
                                                    
                              
                                            
                                            //print_r($data); exit;
				}
}


This function manually works without cron job ... when i assign this to cron job it wont work .. please help me

解决方案

mail=


this->Reports_model_weekly->get_all_usermails();


i=0; foreach(


这篇关于Cron作业问题Javascript没有在php LINUX服务器上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆