Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Ai Galera.. PQ OOP é tão Complicado de Entender.. o Resultado da Errado..
Alguem Pode me Ajudar?
Eu Utilizei aqui o OOP e também Manipulação de Arquivo...
Alguem Me Ajuda..
<?php
/**
* @author
* @copyright 2012
*/
class escrever{
protected $abertura;
protected $arquivo;
function abertura($a , $B){
$t = fopen($a, $B);
$this->abertura = $t;
$this->arquivo = $a;
}
function gravação($conteudo){
fwrite($this->abertura, $conteudo );
}
function ponteiro($valor){
fseek($this->abertura, $valor);
}
function leitura(){
$leitura = fread($this->abertura, filesize($this->arquivo));
echo $leitura;
}
function fechar(){
fclose($this->abertura);
}
}
$arg = new escrever;
$arg->abertura("texto.txt", "w+");
$arg->gravação("Texto Ajuda ... ");
$arg->seek(0);
$arg->leitura();
$arg->fechar();
?>
E da o Seguinte Erro:
( ! ) Warning: fwrite() expects parameter 1 to be resource, null given in C:\wamp\www\sei\teste1.php on line 29
Call Stack
# Time Memory Function Location
1 0.0005 378688 {main}( ) ..\teste1.php:0
2 0.0005 379184 escrever->gravação( ) ..\teste1.php:55
3 0.0006 379216 fwrite ( ) ..\teste1.php:29
( ! ) Warning: fseek() expects parameter 1 to be resource, null given in C:\wamp\www\sei\teste1.php on line 34
Call Stack
# Time Memory Function Location
1 0.0005 378688 {main}( ) ..\teste1.php:0
2 0.0009 379216 escrever->seek( ) ..\teste1.php:56
3 0.0010 379248 fseek ( ) ..\teste1.php:34
( ! ) Warning: fread() expects parameter 1 to be resource, null given in C:\wamp\www\sei\teste1.php on line 39
Call Stack
# Time Memory Function Location
1 0.0005 378688 {main}( ) ..\teste1.php:0
2 0.0012 379184 escrever->leitura( ) ..\teste1.php:57
3 0.0016 379856 fread ( ) ..\teste1.php:39
( ! ) Warning: fclose() expects parameter 1 to be resource, null given in C:\wamp\www\sei\teste1.php on line 46
Call Stack
# Time Memory Function Location
1 0.0005 378688 {main}( ) ..\teste1.php:0
2 0.0019 379760 escrever->fechar( ) ..\teste1.php:58
3 0.0020 379824 fclose ( ) ..\teste1.php:46
Carregando comentários...