cron job将文件保存在root

时间:2016-04-29 06:48:18

标签: php cron

您好我有cron作业,它将文件保存到数据库。当cron作业工作时,它将文件保存到根目录。我不明白为什么它保存文件。比我从godaddy问过。他们告诉我这不是服务器问题检查你的代码。是否可以停止保存文件?我的代码是:

<?php 
header('Content-type: text/plain; charset=utf-8');
require_once "lib/connect.php";
if(isset($_GET['page_id'])){

 function savezar1($name,$video) {
      $sql = "INSERT INTO videos (`video` , `name`,`yes`)       
             VALUES ('$video', '$name','1')";
    mysql_query($sql)or die ("MySQL Error :".mysql_error());

         }



$page_id = $_GET['page_id'];
$access_token = 'facebook access token';

$json_object = @file_get_contents('https://graph.facebook.com/' . $page_id . 
'/feed?access_token=' . $access_token);

  $fbdata = json_decode($json_object);


 foreach ($fbdata->data as $post )
 {
   $content=$post->message;
   $title=$content;
   $title=strip_tags($title);
   $title=trim($title);
   $title=mysql_real_escape_string($title); 
   $l=$post->id;
   $q=explode("_", $l);
     $l='<div id="fb-root"></div><script>(function(d, s, id) {  var js, fjs = d.getElementsByTagName(s)[0];  if (d.getElementById(id)) return;  js = d.createElement(s); js.id = id;  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.3";  fjs.parentNode.insertBefore(js, fjs);}(document, "script", "facebook-jssdk"));</script><div class="fb-video" data-allowfullscreen="1" data-href="https://www.facebook.com/'.$q[0].'/videos/'.$q[1].'/"><div class="fb-xfbml-parse-ignore"><blockquote cite="https://www.facebook.com/'.$q[0].'/videos/'.$q[1].'/"><a href="https://www.facebook.com/'.$q[0].'/videos/'.$q[1].'/"></a><p>'.$title.'</p></blockquote></div></div>';


$video=htmlspecialchars($l, ENT_QUOTES);


 $rsurl=isHaveUrl($title);

    if($rsurl==0)
 {
  savezar1($title,$video);

   }



       }




    }
        ?> 

1 个答案:

答案 0 :(得分:0)

<强>编辑: 你可以在这里找到你的答案

Cron job creating empty file each time it runs

是否正确保存到数据库?