📄 phpl.html
字号:
<br><b><AZTEK> you need the $ before the variables</b>
<br><b><AZTEK> yep</b>
<br><b><vanished></b> ya
<br><b><vanished></b> oops
<br><b><AZTEK> so</b>
<br><font color="#FF0000">*** Sigma has joined #bsrf</font>
<br><b><Canticle></b> php have all the same variables that are in perl?
string,hash,array?
<br><font color="#FF0000">*** Mikkkeee sets mode: +v Sigma</font>
<br><b><AZTEK> for ($i=0;$i<10;$i++)</b>
<br><b><AZTEK> {</b>
<br><b><Sigma></b> Thanks Mike
<br><b><AZTEK> echo "hello";</b>
<br><b><AZTEK> }</b>
<br><b><AZTEK> print aout hello untill the variable $i is ten</b>
<br><b><Sigma></b> php doesn't have a seperate data structure for associative
arrays (hashes). They just let you use strings as keys on any array
<br><b><AZTEK> yes php has all the same variable</b>
<br><b><AZTEK> thats correct</b>
<br><b><Sigma></b> So, @array could be a normal array, or a hash
<br><b><vanished></b> php is glorified perl basically
<br><b><Canticle></b> I see ok
<br><b><AZTEK> scice everytime the code is run the $i++ runs at the
end</b>
<br><b><Sigma></b> vanished: I agree, but it handles variables and input
so well =)
<br><b><AZTEK> the for loop will end after 10 times</b>
<br><b><vanished></b> ya
<br><b><Canticle></b> from what Ive heard php is basicaly streamlined
for serving content that perl does but faster
<br><b><Canticle></b> for web pages
<br><b><vanished></b> php is also a lot more secure :)
<br><b><AZTEK> yes</b>
<br><b><AZTEK> not so much</b>
<br><b><AZTEK> i might get to that later</b>
<br><b><Canticle></b> flexability = insecure :)
<br><b><vanished></b> true
<br><font color="#FF0000">*** Duff19 has joined #bsrf</font>
<br><b><vanished></b> better than straight perl though
<br><b><AZTEK> it also handles out put better</b>
<br><b><vanished></b> right
<br><b><Sigma></b> It's not all that hard to output with perl
<br><b><vanished></b> no
<br><b><AZTEK> instead of having to use ssi includes or writing your
whole page in perl</b>
<br><b><Sigma></b> SSI is slow =\
<br><b><AZTEK> you can just insert the php tags</b>
<br><b><AZTEK> example</b>
<br><font color="#FF0000">*** Mikkkeee sets mode: +v Duff19</font>
<br><b><AZTEK> <title><?php echo $title; ?></title></b>
<br><b><Canticle></b> curious tho for that page tho where would $title
be defined?
<br><b><AZTEK> the would put between the html title tags the value of
the variable $title</b>
<br><b><AZTEK> in an external file</b>
<br><b><AZTEK> i will get to that later</b>
<br><b><Canticle></b> ah cool
<br><b><Sigma></b> Canticle, it might've been in a file, or input from
another webpage
<br><b><Canticle></b> I see, variables in php pages are persistant from
one to another?
<br><b><AZTEK> now from the for loop to the while loop</b>
<br><b><Mikkkeee></b> so whats the output of the <title> a normal
html title?
<br><b><Canticle></b> sorry :) I got off topic back to loop
<br><font color="#FF0000">* Sigma is afk</font>
<br><font color="#FF0000">*** Sigma is now known as Sigma[a]</font>
<br><b><AZTEK> <title>Your title</title></b>
<br><b><AZTEK> now from the for loop to the while loop</b>
<br><b><vanished></b> gotta do homework
<br><b><AZTEK> the while loop folows the syntax of</b>
<br><b><vanished></b> bbl
<br><font color="#FF0000">*** vanished is now known as vanished[homework]</font>
<br><b><AZTEK> while(this is true) {</b>
<br><b><AZTEK> do this</b>
<br><b><AZTEK> }</b>
<br><b><AZTEK> so</b>
<br><font color="#FF0000">*** Duff19 has quit IRC (Quit: Leaving)</font>
<br><b><AZTEK> while($hello="Hi") {</b>
<br><b><AZTEK> echo "Loop";</b>
<br><b><AZTEK> }</b>
<br><b><AZTEK> this will of course never end</b>
<br><b><AZTEK> and will crash the browser eventully</b>
<br><b><AZTEK> which is bad</b>
<br><b><AZTEK> the do is esentilly the same it is</b>
<br><b><AZTEK> do {</b>
<br><b><AZTEK> always do this once</b>
<br><b><AZTEK> } while (do it agian if this is true)</b>
<br><b><AZTEK> i forgot the ; after the while</b>
<br><b><AZTEK> so</b>
<br><b><AZTEK> do {</b>
<br><b><AZTEK> echo "Hello";</b>
<br><font color="#FF0000">*** Kazzuyo has quit IRC (Quit: K2K)</font>
<br><b><AZTEK> } while($hello1<4);</b>
<br><b><AZTEK> this will run once and then run untill the while statment
is false</b>
<br><b><AZTEK> everyone got it</b>
<br><b><Canticle></b> I know you did the if/else.. is there a case statement
as well? Case is usualy easier for me to read if there are 3+ choices
<br><b><AZTEK> yes</b>
<br><b><AZTEK> i belive</b>
<br><b><AZTEK> its is</b>
<br><b><AZTEK> switch($varable) {</b>
<br><b><AZTEK> case :</b>
<br><b><AZTEK> default :</b>
<br><b><AZTEK> }</b>
<br><b><AZTEK> you know how is goes</b>
<br><b><Canticle></b> ok cool. :)
<br><b><AZTEK> now i am going to my final and bigest section</b>
<br><b><AZTEK> drum roll please</b>
<br><b><AZTEK> dudududududud</b>
<br><b><AZTEK> file input/output</b>
<br><b><AZTEK> this is probly the biggest difference between php and
perl</b>
<br><b><Paya></b> finaly
<br><b><AZTEK> to open files in php you use the fopen command</b>
<br><b><AZTEK> so</b>
<br><b><AZTEK> the syntax is</b>
<br><b><Mikkkeee></b> finally
<br><b><Paya></b> k
<br><font color="#FF0000">*** _052_ has joined #bsrf</font>
<br><b><AZTEK> $filehandle=fopen("filename","");</b>
<br><b><AZTEK> sorry i had to get through the other stuff</b>
<br><font color="#FF0000">*** voodoochild has joined #bsrf</font>
<br><font color="#FF0000">*** Mikkkeee sets mode: +v voodoochild</font>
<br><b><AZTEK> the variable $filehandle contans the memory address of
the open file for easy access</b>
<br><b><AZTEK> the filename is of course the filename</b>
<br><b><AZTEK> where the double quotes are</b>
<br><b><AZTEK> in their there should be one of the following</b>
<br><b><AZTEK> 'r' - Open for reading only; place the file pointer at
the beginning of the file.</b>
<br><b><AZTEK> 'r+' - Open for reading and writing; place the file pointer
at the beginning of the file.</b>
<br><b><AZTEK> 'w' - Open for writing only; place the file pointer at
the beginning of the file and truncate the file to zero length. If the
file does not exist, attempt to create it.</b>
<br><b><AZTEK> 'w+' - Open for reading and writing; place the file pointer
at the beginning of the file and truncate the file to zero length. If the
file does not exist, attempt to create it.</b>
<br><b><AZTEK> 'a' - Open for writing only; place the file pointer at
the end of the file. If the file does not exist, attempt to create it.</b>
<br><b><AZTEK> 'a+' - Open for reading and writing; place the file pointer
at the end of the file. If the file does not exist, attempt to create it.</b>
<br><font color="#FF0000">*** Canticle has left #bsrf</font>
<br><b><AZTEK> so example</b>
<br><b><AZTEK> $fh=fopen("hello.txt","r");</b>
<br><b><AZTEK> would open the file hello.txt for reading</b>
<br><b><AZTEK> to get the data from that file you use the fread command</b>
<br><b><AZTEK> the synatx for that is</b>
<br><b><AZTEK> $store=fread($filehandle,lenght to read to);</b>
<br><font color="#FF0000">*** vanished[homework] is now known as vanished</font>
<br><b><vanished></b> back
<br><b><AZTEK> the $store varible is the varible to store the read value
in</b>
<br><font color="#FF0000">*** wishmaster has quit IRC (Quit: )</font>
<br><b><AZTEK> the file handle is what we defined when we opened the
file</b>
<br><b><AZTEK> now the length is special</b>
<br><b><AZTEK> to read the entire file you would put</b>
<br><b><AZTEK> filesize("hello.txt")</b>
<br><b><AZTEK> you CAN NOT put the file handle or it wont work</b>
<br><font color="#FF0000">* Mikkkeee says is everyone awake?</font>
<br><b><AZTEK> so</b>
<br><b><AZTEK> $hello=fread($fh, filesize("hello.txt"));</b>
<br><b><AZTEK> reads the entire file hello.txt into the varible $hello</b>
<br><b><AZTEK> now reading is no fun if we cant write to a file</b>
<br><b><AZTEK> but first we have to close the file as to not take pressious
ram memory</b>
<br><b><AZTEK> so we use fclose</b>
<br><b><AZTEK> the sytax is fclose($filehandle);</b>
<br><b><AZTEK> simple</b>
<br><font color="#FF0000">*** MANOWAR^ has quit IRC (Quit: Ping timeout)</font>
<br><font color="#FF0000">*** Mikkkeee has left #bsrf</font>
<br><font color="#FF0000">*** Mikkkeee has joined #bsrf</font>
<br><font color="#FF0000">*** ChanServ sets mode: +o Mikkkeee</font>
<br><font color="#FF0000">*** N0S01uti0n has joined #bsrf</font>
<br><b><AZTEK> now that we have the old file closed we can open the
same file for writing</b>
<br><font color="#FF0000">*** Mikkkeee sets mode: +v N0S01uti0n</font>
<br><b><AZTEK> so we</b>
<br><b><N0S01uti0n></b> hey i need a short naritive about drugs/narcotics
for my health class... anyone know where i can get one
<br><b><N0S01uti0n></b> thanks mike
<br><b><AZTEK> $fh=fopen("hello.txt","w");</b>
<br><font color="#FF0000">*** DockAlfer has quit IRC (Quit: Good night.)</font>
<br><font color="#FF0000">*** Paya sets mode: +v _medved-</font>
<br><font color="#FF0000">*** Mikkkeee sets mode: +v _052_</font>
<br><font color="#FF0000">*** BootError has quit IRC (Quit: BootError Bot
6.0 Gamma (Shutdown code 3.2 Beta))</font>
<br><b><AZTEK> then we use the fwrite command</b>
<br><font color="#FF0000">*** G0lD has joined #bsrf</font>
<br><font color="#FF0000">*** Mikkkeee sets mode: +v G0lD</font>
<br><b><AZTEK> the syntax is fwrite($fh,string to write to file,optional
value of the length to write);</b>
<br><b><AZTEK> so</b>
<br><b><AZTEK> fwrite=($fh,"Hello");</b>
<br><font color="#FF0000">* Balle[away] 0,12 Away 0,1 Balle 15is not here
11(0Im sleeping.. goddamit..11) (022:09:38 11)</font>
<br><b><AZTEK> now some people can see how you could write the contents
of an html form to a file</b>
<br><b><G0lD></b> does someone in here understand run levels ?
<br><b><HardW1r3></b> shhhhh lecture
<br><b><AZTEK> now i am going to write a short followup tut with code
example and i will cover more file i/o</b>
<br><b><AZTEK> but after you are done writing make sure to close the
file</b>
<br><b><AZTEK> with fclose($fh);</b>
<br><b><AZTEK> and that basicly condludes the php lecture</b>
<br><b><AZTEK> any questions</b>
<br><b><Mikkkeee></b> damn, i need the whole log
<br><font color="#FF0000">*** Serial_Killer has quit IRC (Quit: ALL FOR
ONE,ONE FOR ALL!!!!!!!)</font>
<br><b><AZTEK> i will write the follow up in a few days</b>
<br><b><Paya></b> I have it
<br><b><AZTEK> i got one</b>
<br><b><Mikkkeee></b> okay who will mail me the log
<br><b><Mikkkeee></b> the complete one
<br><font color="#FF0000">*** Mikkkeee sets mode: -m</font>
<br><b><Mikkkeee></b> okay cut log here
<p><b><--------------End of lecture------------></b>
<br>
<br>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -