PDA

View Full Version : خروجی اسکریپت



alimooghashang
جمعه 20 آذر 1388, 19:31 عصر
سلام
چطوری میشه این اسکریپت رو خروجشی رو تو یه فایل ذخیره کنیم؟
با تشکر

<script> document.writeln(document.location)</script>

:متفکر:
HTML clipboard

afshin9032
دوشنبه 23 آذر 1388, 00:51 صبح
با javascript نمي شه چون اين زبان تنها امكان كنترل مرورگر را دارد
بايد از زبان هاي سمت سرور استفاده كني

alimooghashang
پنج شنبه 26 آذر 1388, 00:05 صبح
خوب میشه یه نمونه معرفی کنید؟
که اینطوری اجرا کنم از روی سرور؟
ولی فکر نکنم اونی بشه که من میخوام
من میخوام روی کامپیوتر کاربر انجام بشه
حالا اگه به صورت یه صفحه اینترنتی هم بشه ایرادی نداره!!!

afshin9032
یک شنبه 29 آذر 1388, 23:37 عصر
<script> document.writeln(document.location)</script>
كد بالا نمونه هست
يا مي خواهي عينا خروجي همين دستور ذخيره بشه ؟

alimooghashang
دوشنبه 30 آذر 1388, 17:02 عصر
<script> document.writeln(document.location)</script>
كد بالا نمونه هست
يا مي خواهي عينا خروجي همين دستور ذخيره بشه ؟
این یه مثاله
خب اگه این بشه مثلش هم میشسه دیگه
حالا همین رو بگید خروجخیش چطوری ذخیره میشه تا بعد
مرسی

alimooghashang
دوشنبه 30 آذر 1388, 18:11 عصر
این نوشته به وسیله MFiRE (http://barnamenevis.org/forum/member.php?u=23268) پاک و از دید کاربران مخفی شده است.??؟؟؟؟؟

afshin9032
دوشنبه 30 آذر 1388, 22:44 عصر
كد زير براي نوشتن در فايل بوسيله PHP :




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

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}

// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}

echo "Success, wrote ($somecontent) to file ($filename)";

fclose($handle);

} else {
echo "The file $filename is not writable";
}
?>

alimooghashang
سه شنبه 01 دی 1388, 12:04 عصر
كد زير براي نوشتن در فايل بوسيله PHP :




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

// Let's make sure the file exists and is writable first.
if (is_writable($filename)) {

// In our example we're opening $filename in append mode.
// The file pointer is at the bottom of the file hence
// that's where $somecontent will go when we fwrite() it.
if (!$handle = fopen($filename, 'a')) {
echo "Cannot open file ($filename)";
exit;
}

// Write $somecontent to our opened file.
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}

echo "Success, wrote ($somecontent) to file ($filename)";

fclose($handle);

} else {
echo "The file $filename is not writable";
}
?>

مرسی
ولی من خروجی رو نمیدونم چطوری بگیرم و بریزم رو فایل
میشه بگید خروجی رو چطوری میشه گرفت؟

afshin9032
سه شنبه 01 دی 1388, 13:13 عصر
خواندن محتويات فايل :




<?php
// get contents of a file into a string
$filename = "test.txt";
$handle = fopen($filename, "r");
$contents = fread($handle, filesize($filename));
fclose($handle);
?>