Jump to content
php.lv forumi

fscanf funkcija


Vilsol

Recommended Posts

Tātad neliela problēma ar fxcanf funkciju...

Scripts izskatās šādi:

<?php
$date = date('Y-n-j');
$file = 'C:\Users\Vilsol\Desktop\MineCraftServeris\logs\\'.$date.'.txt';
$handle = fopen($file);
while ($userinfo = fscanf($handle, "\!PLAYERS ONLINE: %s\n")) {
   list ($name) = $userinfo;
echo $name;
}
fclose($handle);
?>

 

Bet man viņš neko nerāda...

Pamēģināju ar echo $file un tads fails pastaav...

Man vajag lai vinš no faila izvelk šādu rindiņu: !PLAYERS ONLINE: Anon73, Quaranty, Shrinkys112, ClayC, rickboy26, Redmaz, Fluffybunni2, hcy8

(cilvēku saraksts var atšķirties bet es domāju tos atdalīt ar explode...)

bet viņš nerāda neko... lūdzu palīdziet

paldies jau iepriekš :)

Link to comment
Share on other sites

nestraadaa tikuntaa

ps atklaaju ka scripts nespeeja atrast failu tapeec naacaas parmest uz weba direktoriju...

tatad tagad scripts ir taads:

<?php
$date = date('Y-n-j');
$file = 'MineCraftServeris/logs/'.$date.'.txt';
$handle = fopen($file);
while ($userinfo = fscanf($handle, "\!PLAYERS ONLINE: %s\r\n")) {
   list ($name) = $userinfo;
echo $name;
}
fclose($handle);
?>

Link to comment
Share on other sites

tikuntā nav....

<?php
$date = date('Y-n-j');
$file = 'MineCraftServeris/logs/'.$date.'.txt';
$handle = fopen($file, 'r');
while ($userinfo = fscanf($handle, "!PLAYERS ONLINE: %[a-zA-Z0-9,. ]\r\n")) {
   list ($name) = $userinfo;
echo $name;
}
fclose($handle);
?>

Link to comment
Share on other sites

tikuntā nekas...

<?php
$date = date('Y-n-j');
$file = ''.$date.'.txt';
$file2 = 'MineCraftServeris/logs/'.$date.'.txt';
$handle = fopen($file, 'r');
while ($userinfo = fscanf($handle, "!PLAYERS ONLINE: %[a-zA-Z0-9,. ]\r\n")) {
   list ($name) = $userinfo;
echo $name;
}
fclose($handle);
?>

Edited by Vilsol
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...