1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ファイルの中に記述されている1行目を取得し、画面に表示させたい

Last updated at Posted at 2018-07-10

Macでワードで、
1行目
2行目
3行目
と文字を打ち、txtにして保存しました。(ファイル名:phptanaka)
次にviエディタで下記を打ち込みました。

<?php
  
$fp= fopen("phptanaka","r");

$lines = fgets($fp);

fclose($fp);

$hoge = file("phptanaka");
print $hoge[0];

?>
Warning: fopen(phptanaka): failed to open stream: No such file or directory in /Users/tanakaakio/aaa.php on line 3

Warning: fgets() expects parameter 1 to be resource, boolean given in /Users/tanakaakio/aaa.php on line 5

Warning: fclose() expects parameter 1 to be resource, boolean given in /Users/tanakaakio/aaa.php on line 7

Warning: file(phptanaka): failed to open stream: No such file or directory in /Users/tanakaakio/aaa.php on line 9

素人すぎてエラー内容を見ても解決のすべがわかりません。何が間違っているかご助言頂けると幸いです。宜しくお願いします。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?