摘要: 了解使用 fopen、fclose、feof、fgets、fgetss 和 fscanf 1.传统的 fopen 方法用 fgets 打开并读取文件 $file_handle = fopen("myfile", "r"); //打开文件。$file_handle 存储了一个对文件本身的引用。 while (!feof($file_handle)) { // 检查是否已到达文件的末尾。 $line = fgets($file_handle); //继续读取文件,直至到达文件末尾,边读取边打印每行。 echo $line; }fclose($file_han 阅读全文
posted @ 2012-09-26 17:31 hlp鹏 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1.this和对象的关系var person = { name:'Theo Wong', gender:'male', getName:function(){ console.log(person.name); //person.name=this.name; }};person.getName();this永远指向的是函数对象的所有者!上面的例子中getName的所有者是person对象,所以this指代的是person。2.this和全局对象所以在全局函数中,this指代的是window对象(除非使用new,call,apply方法来改变this的指代关系) 阅读全文
posted @ 2012-09-26 16:20 hlp鹏 阅读(124) 评论(0) 推荐(0) 编辑