PHP ECHO DEĞİŞKEN

0 Cevap php

I managed to create a new line for each only with :

$content1= hot("britney") ? "britney found" : "";
$content2= hot("gaga") ? "gaga found" : "";
$content3= hot("carol") ? "carol found" : ""; 

$filename = 'result.txt';
$handle = fopen($filename, 'a');
fwrite($handle, "$Content1\r\n");
fwrite($handle, "$Content2\r\n");
fwrite($handle, "$Content3\r\n");
fwrite($handle, "$Content4\r\n");
fclose($handle);

But i have many lines and it makes a lot of modifications... How could i automatize the process ? maybe something like foreach < i really don't know how to implement this one here'

Ben aşağıdaki kodları var:

require("class.XMLHttpRequest.php");
function hot($news){
    $url="https://localhost/search.aspx?search=".$news.""; 
 $ajax=new XMLHttpRequest();
 $ajax->setRequestHeader("Cookie","Cookie: host");
 $ajax->open("GET",$url,true);
 $ajax->send(null);
 if($ajax->status==200){
  $rHeader=$ajax->getResponseHeader("Set-Cookie");
  if(substr_count($rHeader, "Present!")>0) { return true; }
 }else{ return false; }
} 

echo ( hot("britney") )?"britney found":"<br>";
echo ( hot("gaga") )?"gaga found":"<br>";
echo ( hot("carol") )?"carol found":"<br>"; 

VE

<?php
$filename = 'test.txt';
$Content = "Add this to the file\r\n";

echo "open";
$handle = fopen($filename, 'x+');
echo " write";
fwrite($handle, $Content);
echo " close";
fclose($handle);
?>

ve i echo ( hot("britney") )?"britney found":"<br>"; benim komut ve bu nedenle pek çok i bir dosyaya göndermek istiyorum

how can i set a string for echo ( hot("britney") )?"britney found":"<br>"; bilgi dosyasına gönderir benim kod kullanmak mümkün

ben de sayfa ekrana bir şey yazdırmak istemiyorum

0 Cevap