1 / 15

Skedaret

Skedaret. Programim ne Web Leksion 8. Perfshirja i skedareve me include(). < html> < head> <title>Si te perdorim include ()</title> </ head> < body> <? php include (" listing.php "); ?> </ body> </ html>. Perfshirja i skedareve me include(). Permbajtja e listing.php

keefe-rocha
Download Presentation

Skedaret

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Skedaret Programim ne Web Leksion 8 Iralda Mitro

  2. Perfshirja i skedareve me include() <html> <head> <title>Si teperdorim include()</title> </head> <body> <?php include("listing.php"); ?> </body> </html> Iralda Mitro

  3. Perfshirja i skedareve me include() • Permbajtja e listing.php I have been included!! Iralda Mitro

  4. Perdorimii include() per teekzekutuar PHP ne njeskedartjeter <html> <head> <title> Perdorimii include() per teekzekutuar PHP ne njeskedartjeter </title> </head> <body> <?php include("listing2.php"); ?> </body> </html> Iralda Mitro

  5. Nje skedar include qe mban kod PHP • listing2.php <?php print "I have been included!"; print "But now I can add up... 4 + 4 = ".(4 + 4); ?> • I have been included!! But now I can add up... 4 + 4 = 8 Iralda Mitro

  6. Kthimi i nje vlere nga nje dokument i perfshire <html> <head> <title>Using include() to execute PHP and assign the return value</title> </head> <body> <?php $addResult = include("listing3.php"); print "The include file returned $addResult"; ?> </body> </html> Iralda Mitro

  7. Kthimi i nje vlere nga nje dokument i perfshire • An Include File That Returns a Value <?php $retval = (4 + 4); return $retval; ?> This HTML will never be displayed because it comes after a return statement! • The include file returned 8 Iralda Mitro

  8. Perdorimii include() brendastrukturavetekontrollit <html> <head> <title>Using include() within a loop</title> </head> <body> <?php for ( $x = 1; $x<=3; $x++ ) { $incfile = "incfile$x".".txt"; print "Attempting include $incfile<br>"; include( "$incfile" ); print "<p>"; } ?> </body> </html> Iralda Mitro

  9. Testimiiekzistences se skedareve if (file_exists("test.txt")) { print "The file exists!"; } Iralda Mitro

  10. Testimi i skedareve • Skedarapodirektori? if (is_file("test.txt")) { print "test.txt is a file!"; } if (is_dir("/tmp")) { print "/tmp is a directory"; } Iralda Mitro

  11. TestimiStatusitteskedareve if (is_readable("test.txt")) { print "test.txt is readable"; } if (is_writable("test.txt")) { print "test.txt is writable"; } if (is_executable("test.txt")) { print "test.txt is executable"; } Iralda Mitro

  12. Testimimadhesise se skedareve print "The size of test.txt is.. "; print filesize("test.txt"); Iralda Mitro

  13. Shembull: Testimiiskedareve 1: <html> 2: <head> 3: <title>Listing 10.8 A function to output the results of 4: multiple file tests</title> 5: </head> 6: <body> 7: <?php 8: $file = "test.txt"; 9: outputFileTestInfo($file); 11: function outputFileTestInfo($f) { 12: if (!file_exists($f)) { 13: print "$f does not exist<BR>"; 14: return; 15: } 16: print "$f is ".(is_file($f)?"":"not ")."a file<br>"; 17: print "$f is ".(is_dir($f)?"":"not ")."a directory<br>"; 18: print "$f is ".(is_readable($f)?"":"not ")."readable<br>"; 19: print "$f is ".(is_writable($f)?"":"not ")."writable<br>"; 20: print "$f is ".(is_executable($f)?"":"not ")."executable<br>"; 21: print "$f is ".(filesize($f))." bytes<br>"; 22: print "$f was accessed on ".date("D d M Y g:i A",fileatime($f))."<br>"; 23: print "$f was modified on ".date("D d M Y g:i A",filemtime($f))."<br>"; 24: print "$f was changed on ".date("D d M Y g:i A",filectime($f))."<br>"; 25: } 27: ?> 28: </body> 29: </html> Iralda Mitro

  14. Hapja e skedaritper lexim, shkrimdheshtim • $fp = fopen("test.txt", 'r'); • $fp = fopen("test.txt", 'w'); • $fp = fopen("test.txt", ‘a'); Iralda Mitro

  15. Mbyllja e skedarit • $fp = fopen("test.txt", 'r'); • fclose($fp); Iralda Mitro

More Related