Autor Zpráva
Radicz
Profil *
Zdravim všechny. Mohl by mi prosim někdo říct proč mi tohle nefunguje? Pořád mi to píše tuhle chybu


Warning: file() expects parameter 1 to be string, resource given in C:\Program Files\Programy\VertrigoServ\www\sms\sms.php on line 26

a já už nevim co s tim. Děkuji

  $cesta = "smsd";
  
  $adresar = opendir($cesta);
  $soubor = readdir($adresar);
  
  
  while ($soubor = readdir($adresar))
  {
    if ($soubor != "." && $soubor != "..")
    {
      $otevrit = fopen($cesta."/".$soubor, "r+");
      $pole = File($otevrit);
      
    }
  } 
Taps
Profil
Radicz
zkus to jednodušeji
<?php
$cesta="./slozka";
if ($handle = opendir($cesta)) {
    while (false !== ($file = readdir($handle))) {
        if ($file != "." && $file != "..") {
            echo "$file\n";
        }
    }
    closedir($handle);
}
?>

Radicz
Profil *
Díky za odpověď ale nejde mi o vypsání souborů, ale o to načíst ten soubor v tý složce pomocí File do pole abych ho mohl dále zpracovávat
Casero
Profil
Radicz
$cesta = "smsd";

$adresar = opendir($cesta);
$soubor = readdir($adresar);


while ($soubor = readdir($adresar))
{
if ($soubor != "." && $soubor != "..")
{
$otevrit =$cesta."/".$soubor;
$pole = File($otevrit);

}
}
S tím, že se ti proměná pole stale prepisuje.
Radicz
Profil *
Myslim že to nebu tim chyba zůstává i v tomhle zápisu

$otevrit = fopen("smsd/pokus.txt", "r");
$pole = File($otevrit);
Alphard
Profil
Myslim že to nebu tim chyba zůstává i v tomhle zápisu

$otevrit = fopen("smsd/pokus.txt", "r");
$pole = File($otevrit);



za každou cenu tam cpete fopen, které tam ale nemá co dělat, parametrem file() je cesta k souboru, ne handler od fopen()

a proměnná $pole se bude furt přepisovat
Radicz
Profil *
Máte pravdu děkuji Vám, kdyby to někoho zajímalo nakonec jsem to tedy udělal takto

    $adresar = opendir("smsd");

    while ($soubor = readdir($adresar))
            
      if ($soubor != "." && $soubor != "..")
      {   
        $pole = File("smsd/$soubor");
      }
      
      echo $pole[0]."<br>";
      echo $pole[1]."<br>";
      echo $pole[2];

Vaše odpověď

Mohlo by se hodit


Prosím používejte diakritiku a interpunkci.

Ochrana proti spamu. Napište prosím číslo dvě-sta čtyřicet-sedm:

0