Include Php Não Funcioa
#1
Posted 31/05/2007, 15:19
tenho um pequeno código que deveria mostrar em minha página últimas notícias, mas não funciona:
<?
$arquivostatus = "http://www.boletimpe...s/include.php"; //
$status = fopen($arquivostatus, "r");
$permissao = fgets($status,1000);
fclose($status);
print ("Notícias:<br>".$permissao);
?>
O que está errado?
incluí este código em minha página e a salvei como index.php....
Mas só imprime a palavra Notícias, as notícias não aparecem....
Obrigado
#2
Posted 31/05/2007, 15:52
Amigos,
tenho um pequeno código que deveria mostrar em minha página últimas notícias, mas não funciona:
<?
$arquivostatus = "http://www.boletimpe...s/include.php"; //
$status = fopen($arquivostatus, "r");
$permissao = fgets($status,1000);
fclose($status);
print ("Notícias:<br>".$permissao);
?>
O que está errado?
incluí este código em minha página e a salvei como index.php....
Mas só imprime a palavra Notícias, as notícias não aparecem....
Obrigado
Manual neleeee! *TOF*
Se lesse o final da documentação do include (Aqui), iria saber deste trecho:
If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be included using a URL (via HTTP or other supported wrapper - see Appendix N, List of Supported Protocols/Wrappers for a list of protocols) instead of a local pathname. If the target server interprets the target file as PHP code, variables may be passed to the included file using a URL request string as used with HTTP GET. This is not strictly speaking the same thing as including the file and having it inherit the parent file's variable scope; the script is actually being run on the remote server and the result is then being included into the local script.
Ou seja, (cerveja ; ... se você nao ativar a url fopen wrappers, seu includes remotos não funcionarão, apenas includes locais.
"Mas tio ... o que é um include local?"
Includes locais são includes no path real do documento.
Exemplo:
index.php (assumindo que ele esteja num diretório qualquer)
<?php include("pages/a.php"); ?>
O include irá olhar para o diretório pages, e incluir o a.php.
Se seu index.php estiver em C:\site\index.php, o include irá olhar em C:\site\pages.
Entendeu?
Qualer coisa estamos as ordens... :B
#3
Posted 31/05/2007, 15:56
Bicho tenta assimAmigos,
tenho um pequeno código que deveria mostrar em minha página últimas notícias, mas não funciona:
<?
$arquivostatus = "http://www.boletimpe...s/include.php"; //
$status = fopen($arquivostatus, "r");
$permissao = fgets($status,1000);
fclose($status);
print ("Notícias:<br>".$permissao);
?>
O que está errado?
incluí este código em minha página e a salvei como index.php....
Mas só imprime a palavra Notícias, as notícias não aparecem....
Obrigado
<? fopen ("http://www.boletimpecuario.com.br/noticias/include.php", "r"); ?>
p fopen é para abrir um arquivo ou um html, não sei oq vc está querendo fazer, mas acho que vc deveria usar o comando include.
o código seria
<? include "http://www.boletimpecuario.com.br/noticias/include.php"; ?>De qualquer forma estude as duas funções
fopen => http://www.php.net/m...ction.fopen.php
include => http://www.php.net/m...ion.include.php
cara acabei de acessar o endereço http://www.boletimpe...ias/include.php
use include mesmo
#4
Posted 01/06/2007, 12:00
funcionou! Obrigado amigos!
Abraço,
0 user(s) are reading this topic
0 membro(s), 0 visitante(s) e 0 membros anônimo(s)