一千萬個為什麽

搜索

高推文狀態ID導致無法打開流錯誤?


爾格。從過去幾天開始,高推文ID(至少,它似乎與ID相關,但我認為它可能是最近api返回的一些變化)正在破壞我的代碼。起初我嘗試將ID作為字符串而不是整數傳遞給此函數,我認為這有效,但實際上只是從我的結尾上傳文件的過程。

簡而言之,php腳本會生成這些函數調用,當它執行此操作時,它們會失敗。如果我下載生成調用的php文件,刪除服務器副本並重新上傳完全相同的文件而不更改它,它工作正常。有誰知道可能導致這種行為的原因是什麽?

以下是我懷疑是拉動錯誤的單個文件中最重要的部分。每個文件都以狀態ID命名(例如,下面的文件名為12058543656.php)

<?php
    require "singlePost.php";
    SinglePost(12058543656)
    ?>

這是編寫上述文件的代碼:

      $postFileName = $single_post_id.".php";
  if(!file_exists($postFileName)){
    $created_at_full = date("l, F jS, Y", strtotime($postRow[postdate])-(18000));
    $postFileHandle = fopen($postFileName, 'w+');
    fwrite($postFileHandle, '<html>
<head>
<title><?php $thisTITLE = "escarp | A brief poem or short story by '.$authorname.' on '.$created_at_full.'"; echo $thisTITLE;?></title><meta NAME="Description" CONTENT="This brief poem or short story, by '.$authorname.', was published on '.$created_at_full.'">
<?php include("head.php");?>
To receive other poems or short stories like this one from escarp on your cellphone, create and/or associate a Twitter account with your cellphone, follow us, and turn device updates on.
<?php
    require "singlePost.php";
    SinglePost("'.$single_post_id.'")
    ?>
</div></div>
<?php include("foot.php");?>
</body>
</html>');
    fclose($postFileHandle);}
  $postcounter++;
  }

I can post more if you don't see anything here, but there are several files involved and I'm trying to avoid dumping tons of irrelevant code.

Error:

Warning: include(head.php) [function.include]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 4 Warning: include(head.php) [function.include]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 4

Warning: include() [function.include]: Failed opening 'head.php' for inclusion (include_path='.:/nfsn/apps/php5/lib/php/:/nfsn/apps/php/lib/php/') in /f2/escarp/public/12177797583.php on line 4 To receive other poems or short stories like this one from escarp on your cellphone, create and/or associate a Twitter account with your cellphone, follow us, and turn device updates on.

Warning: require(singlePost.php) [function.require]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 7

Warning: require(singlePost.php) [function.require]: failed to open stream: No such file or directory in /f2/escarp/public/12177797583.php on line 7

Fatal error: require() [function.require]: Failed opening required 'singlePost.php' (include_path='.:/nfsn/apps/php5/lib/php/:/nfsn/apps/php/lib/php/') in /f2/escarp/public/12177797583.php on line 7

SinglePost()

<?php
function SinglePost($statusID) {
require "nicetime.php";
$db = sqlite_open("db.escarp");
$updates = sqlite_query($db, "SELECT * FROM posts WHERE postID = '$statusID'");
$row = sqlite_fetch_array($updates, SQLITE_ASSOC);
 $id = $row[authorID];
 $result = sqlite_query($db, "SELECT * FROM authors WHERE authorID = '$id'");
 $row5 = sqlite_fetch_array($result, SQLITE_ASSOC);
  $created_at_full = date("l, F jS, Y", strtotime($row[postdate])-(18000));
  $created_at = nicetime($row[postdate]);
  if($row5[url]==""){
  $authorurl = '';
  }
  else{
    /*I'm omitting a few pages of output code and associated regex*/
    return;
  }
?>

最佳答案

我懷疑高ID值是否會導致您的問題(至少,與數據類型無關)。

當PHP檢測到整數溢出時,它會自動將值轉換為浮點數以防止它。因此,您可以(有些)代表大數字而沒有任何問題。


話雖如此,請確保文件的完整路徑不超過文件系統的路徑長度限制,並且文件夾中的文件數也不超過限制(例如,65534條目是< strong> NTFS 分區)。

轉載註明原文: 高推文狀態ID導致無法打開流錯誤?

猜你喜歡