新程php培训–就业率100%的php培训中心 全国免费咨询热线 400-668-8834 了解更多,请访问 http://www.phppx.com
2010/01/26学员就业

评论关闭

李震毕业感言


学员姓名:李震就业情况:

就业于水晶石数字科技有限公司 (http://www.crystalcg.com/cn/

李震毕业感言

    转眼之间,我的三个月的培训已经结束了.时间虽然短暂,也许与高中或者大学无法相比,可这三个月朋友之间的喜怒哀乐与缴老师不厌其烦的讲解.这些回忆才是 最宝贵和美好的. 记得我们刚刚来到新程培训的时候是那样的稚嫩,关于培训的项目我们可以说是”零”基础,虽然是大学刚刚毕业,可四年的大学生活中,又能真正学到些什 么………
     在来到新程PHP培训之前,已经大学毕业半年多了,我在大学学的专业是计算机网络技术,在大学毕业后自然而然也就围着关于网络的工作找,面对着一次次的招 聘会,面对着一次次的尴尬与摇头,自己才发现,大学所学的东西怎么那么没有用呢,怎么就找不到一个工作呢,一个关于网络的工作这么难找吗???
     之后,跟父母研究以后,决定找个培训班,在充充电,就这样找到了新程PHP培训,与缴老师结识了.
     我选择的是LAMP全能就业班,在这三个月的学习中,真的就一个感觉,每天都在飞快的成长,每天都在飞快的进步.
     在缴老师的教学中,我感觉到了什么叫做责任心,由于我们来的时候对于PHP都是零基础,所以感觉比较笨,但是无论我们怎么笨,怎么不会,怎么听不懂,缴老 师都是始终如一的去讲解每一个问题,每一个知识点一直讲到我们点头说会为止,在签订合同的时候,上课时间只有一上午,可是实际上课的时间基本都是一整天, 一整天的上,缴老师从来没有在收取别的费用了.
      三个月的时间过去了,缴老师也按照合同给我们找到了工作,可没想到的是给我们找到了一家这么有实力,这么大的公司—水晶石数字科技有限公司.这是一家跨国公司,在中国 北京,天津上海等都有公司,在英国伦敦也有分公司,还是2012年奥运会合作伙伴…
     缴老师的培训班没得说,一个字”棒”,两个字”责任”,
     最后祝愿新程PHP培训班越办越好,哈哈其实不用祝愿也会办的越来越好的,因为有着一个这么负责任的老师在指导着我们前进,临了给新程写了一首小诗…..

      新程诗
新山青,程山青
两岸青山相对迎
总关同窗离别情
祝愿新程往前行

一个操作xml的PHP类(附使用方法)

<?php
/**
* @copyright 互联网
* 整理:[url]www.phppx.com[/url]
* @desc 一个操作xml的PHP类
*/

/*
   (c) 2000 Hans Anderson Corporation.  All Rights Reserved.
   You are free to use and modify this class under the same
   guidelines found in the PHP License.

   ———–

   bugs/me:
   [url]http://www.hansanderson.com/php/[/url]
   [email]me@hansanderson.com[/email]
   [email]showstv@163.com[/email]

   ———–

   Version 1.0

      – 1.0 is the first actual release of the class.  It”s 
       finally what I was hoping it would be, though there
       are likely to still be some bugs in it.  This is
       a much changed version, and if you have downloaded
       a previous version, this WON”T work with your existing
       scripts!  You”ll need to make some SIMPLE changes.

      – .92 fixed bug that didn”t include tag attributes

       (to use attributes, add _attributes[array_index]
        to the end of the tag in question:
        $xml_html_head_body_img would become
        $xml_html_head_body_img_attributes[0], 
        for example)

        — Thanks to Nick Winfield <[email]nick@wirestation.co.uk[/email]>
          for reporting this bug.

      – .91 No Longer requires PHP4!

      – .91 now all elements are array.  Using objects has
       been discontinued.
*/

class xml_container{

   function store($k,$v) {
      $this->{$k}[] = $v;
   }
}
/* parses the information */
/*********************************
*   类定义开始
*
*********************************/
class xml{
  
   // initialize some variables
   var $current_tag=array();
   var $xml_parser;
   var $Version = 1.0;
   var $tagtracker = array();

   /* Here are the XML functions needed by expat */
   /* when expat hits an opening tag, it fires up this function */
   function startElement($parser, $name, $attrs){

      array_push($this->current_tag, $name); // add tag to the cur. tag array
      $curtag = implode(“_”,$this->current_tag); // piece together tag

      /* this tracks what array index we are on for this tag */

      if(isset($this->tagtracker["$curtag"])) {
        $this->tagtracker["$curtag"]++;
      }
      else{
        $this->tagtracker["$curtag"]=0;
      }

      /* if there are attributes for this tag, we set them here. */

      if(count($attrs)>0) {
        $j = $this->tagtracker["$curtag"];
        if(!$j) $j = 0;

        if(!is_object($GLOBALS[$this->identifier]["$curtag"][$j])) {
           $GLOBALS[$this->identifier]["$curtag"][$j] = new xml_container;
        }

        $GLOBALS[$this->identifier]["$curtag"][$j]->store(“attributes”,$attrs);
      }
  
   }// end function startElement

   /* when expat hits a closing tag, it fires up this function */
   function endElement($parser, $name) {
      $curtag = implode(“_”,$this->current_tag); // piece together tag
     
      // before we pop it off,
      // so we can get the correct
      // cdata

      if(!$this->tagdata["$curtag"]) {
        $popped = array_pop($this->current_tag); // or else we screw up where we are
        return; // if we have no data for the tag
      }
      else{
        $TD = $this->tagdata["$curtag"];
        unset($this->tagdata["$curtag"]);
      }

      $popped = array_pop($this->current_tag);
      // we want the tag name for
      // the tag above this, it 
      // allows us to group the
      // tags together in a more
      // intuitive way.

      if(sizeof($this->current_tag) == 0) return; // if we aren”t in a tag

      $curtag = implode(“_”,$this->current_tag); // piece together tag
      // this time for the arrays

      $j = $this->tagtracker["$curtag"];
     
      if(!$j) $j = 0;

      if(!is_object($GLOBALS[$this->identifier]["$curtag"][$j])) {
        $GLOBALS[$this->identifier]["$curtag"][$j] = new xml_container;
      }

      $GLOBALS[$this->identifier]["$curtag"][$j]->store($name,$TD);
      #$this->tagdata["$curtag"]);
      unset($TD);
      return TRUE;
   } // end function endElement
   /* when expat finds some internal tag character data,
     it fires up this function */

   function characterData($parser, $cdata) {
      $curtag = implode(“_”,$this->current_tag); // piece together tag
      $this->tagdata["$curtag"] .= $cdata;
   }
   function xml($data,$identifier=”xml”) { 

      $this->identifier = $identifier;

      // create parser object
      $this->xml_parser = xml_parser_create();

      // set up some options and handlers
      xml_set_object($this->xml_parser,$this);
      xml_parser_set_option($this->xml_parser,XML_OPTION_CASE_FOLDING,0);
      xml_set_element_handler($this->xml_parser, “startElement”, “endElement”);
      xml_set_character_data_handler($this->xml_parser, “characterData”);

      if (!xml_parse($this->xml_parser, $data, TRUE)) {
        sprintf(“XML error: %s at line %d”,
        xml_error_string(xml_get_error_code($this->xml_parser)),
        xml_get_current_line_number($this->xml_parser));
      }

      // we are done with the parser, so let”s free it
      xml_parser_free($this->xml_parser);

   }//end constructor: function xml()
}//thus, we end our class xml

?>

使用方法:

<?php
require(“class.xml.php”);
$file = “data.xml”;
$data = implode(“”,file($file)) or die(“could not open XML input file”);
$obj = new xml($data,”xml”);
print $xml["hans"][0]->num_results[0];
for($i=0;$i<sizeof($xml["hans"]);$i++) {
        print $xml["hans"][$i]->tag[0] . ” “;
}

//To print url attributes (if they exist):

print $xml["hans"][0]->attributes[0]["size"];

?>

PHP邮件发送类(附使用方法)

email.class.php  代码:

<?
/**
* 来源:互联网
* 整理:www.phppx.com
*/
class smtp
{
        /* Public Variables */
        var $smtp_port;
        var $time_out;
        var $host_name;
        var $log_file;
        var $relay_host;
        var $debug;
        var $auth;
        var $user;
        var $pass;

        /* Private Variables */
        var $sock;

        /* Constractor */
        function smtp($relay_host = “”, $smtp_port = 25,$auth = false,$user,$pass)
        {
                $this->debug = FALSE;
                $this->smtp_port = $smtp_port;
                $this->relay_host = $relay_host;
                $this->time_out = 30; //is used in fsockopen()
                #
                $this->auth = $auth;//auth
                $this->user = $user;
                $this->pass = $pass;
                #
                $this->host_name = “localhost”; //is used in HELO command
                $this->log_file =”";

                $this->sock = FALSE;
        }

        /* Main Function */
        function sendmail($to, $from, $subject = “”, $body = “”, $mailtype, $cc = “”, $bcc = “”, $additional_headers = “”)
        {
                $mail_from = $this->get_address($this->strip_comment($from));
                $body = ereg_replace(“(^|(\r\n))(\\.)”, “\\1.\\3“, $body);
                $header .= “MIME-Version:1.0\r\n”;
                if($mailtype==”HTML”){
                        $header .= “Content-Type:text/html\r\n”;
                }
                $header .= “To: “.$to.”\r\n”;
                if ($cc != “”) {
                        $header .= “Cc: “.$cc.”\r\n”;
                }
                $header .= “From: $from<”.$from.”>\r\n”;
                $header .= “Subject: “.$subject.”\r\n”;
                $header .= $additional_headers;
                $header .= “Date: “.date(“r”).”\r\n”;
                $header .= “X-Mailer:By Redhat (PHP/”.phpversion().”)\r\n”;
                list($msec, $sec) = explode(” “, microtime());
                $header .= “Message-ID: <”.date(“YmdHis”, $sec).”.”.($msec*1000000).”.”.$mail_from.”>\r\n”;
                $TO = explode(“,”, $this->strip_comment($to));

                if ($cc != “”) {
                        $TO = array_merge($TO, explode(“,”, $this->strip_comment($cc)));
                }

                if ($bcc != “”) {
                        $TO = array_merge($TO, explode(“,”, $this->strip_comment($bcc)));
                }

                $sent = TRUE;
                foreach ($TO as $rcpt_to) {
                        $rcpt_to = $this->get_address($rcpt_to);
                        if (!$this->smtp_sockopen($rcpt_to)) {
                                $this->log_write(“Error: Cannot send email to “.$rcpt_to.”\n”);
                                $sent = FALSE;
                                continue;
                        }
                        if ($this->smtp_send($this->host_name, $mail_from, $rcpt_to, $header, $body)) {
                                $this->log_write(“E-mail has been sent to <”.$rcpt_to.”>\n”);
                        } else {
                                $this->log_write(“Error: Cannot send email to <”.$rcpt_to.”>\n”);
                                $sent = FALSE;
                        }
                        fclose($this->sock);
                        $this->log_write(“Disconnected from remote host\n”);
                }
                echo “<br>”;
                echo $header;
                return $sent;
        }

        /* Private Functions */

        function smtp_send($helo, $from, $to, $header, $body = “”)
        {
                if (!$this->smtp_putcmd(“HELO”, $helo)) {
                        return $this->smtp_error(“sending HELO command”);
                }
                #auth
                if($this->auth){
                        if (!$this->smtp_putcmd(“AUTH LOGIN”, base64_encode($this->user))) {
                                return $this->smtp_error(“sending HELO command”);
                        }

                        if (!$this->smtp_putcmd(“”, base64_encode($this->pass))) {
                                return $this->smtp_error(“sending HELO command”);
                        }
                }
                #
                if (!$this->smtp_putcmd(“MAIL”, “FROM:<”.$from.”>”)) {
                        return $this->smtp_error(“sending MAIL FROM command”);
                }

                if (!$this->smtp_putcmd(“RCPT”, “TO:<”.$to.”>”)) {
                        return $this->smtp_error(“sending RCPT TO command”);
                }

                if (!$this->smtp_putcmd(“DATA”)) {
                        return $this->smtp_error(“sending DATA command”);
                }

                if (!$this->smtp_message($header, $body)) {
                        return $this->smtp_error(“sending message”);
                }

                if (!$this->smtp_eom()) {
                        return $this->smtp_error(“sending <CR><LF>.<CR><LF> [EOM]“);
                }

                if (!$this->smtp_putcmd(“QUIT”)) {
                        return $this->smtp_error(“sending QUIT command”);
                }

                return TRUE;
        }

        function smtp_sockopen($address)
        {
                if ($this->relay_host == “”) {
                        return $this->smtp_sockopen_mx($address);
                } else {
                        return $this->smtp_sockopen_relay();
                }
        }

        function smtp_sockopen_relay()
        {
                $this->log_write(“Trying to “.$this->relay_host.”:”.$this->smtp_port.”\n”);
                $this->sock = @fsockopen($this->relay_host, $this->smtp_port, $errno, $errstr, $this->time_out);
                if (!($this->sock && $this->smtp_ok())) {
                        $this->log_write(“Error: Cannot connenct to relay host “.$this->relay_host.”\n”);
                        $this->log_write(“Error: “.$errstr.” (“.$errno.”)\n”);
                        return FALSE;
                }
                $this->log_write(“Connected to relay host “.$this->relay_host.”\n”);
                return TRUE;;
        }

        function smtp_sockopen_mx($address)
        {
                $domain = ereg_replace(“^.+@([^@]+)$“, “\\1“, $address);
                if (!@getmxrr($domain, $MXHOSTS)) {
                        $this->log_write(“Error: Cannot resolve MX \”".$domain.”\”\n”);
                        return FALSE;
                }
                foreach ($MXHOSTS as $host) {
                        $this->log_write(“Trying to “.$host.”:”.$this->smtp_port.”\n”);
                        $this->sock = @fsockopen($host, $this->smtp_port, $errno, $errstr, $this->time_out);
                        if (!($this->sock && $this->smtp_ok())) {
                                $this->log_write(“Warning: Cannot connect to mx host “.$host.”\n”);
                                $this->log_write(“Error: “.$errstr.” (“.$errno.”)\n”);
                                continue;
                        }
                        $this->log_write(“Connected to mx host “.$host.”\n”);
                        return TRUE;
                }
                $this->log_write(“Error: Cannot connect to any mx hosts (“.implode(“, “, $MXHOSTS).”)\n”);
                return FALSE;
        }

        function smtp_message($header, $body)
        {
                fputs($this->sock, $header.”\r\n”.$body);
                $this->smtp_debug(“> “.str_replace(“\r\n”, “\n”.”> “, $header.”\n> “.$body.”\n> “));

                return TRUE;
        }

        function smtp_eom()
        {
                fputs($this->sock, “\r\n.\r\n”);
                $this->smtp_debug(“. [EOM]\n”);

                return $this->smtp_ok();
        }

        function smtp_ok()
        {
                $response = str_replace(“\r\n”, “”, fgets($this->sock, 512));
                $this->smtp_debug($response.”\n”);

                if (!ereg(“^[23]“, $response)) {
                        fputs($this->sock, “QUIT\r\n”);
                        fgets($this->sock, 512);
                        $this->log_write(“Error: Remote host returned \”".$response.”\”\n”);
                        return FALSE;
                }
                return TRUE;
        }

        function smtp_putcmd($cmd, $arg = “”)
        {
                if ($arg != “”) {
                        if($cmd==”") $cmd = $arg;
                        else $cmd = $cmd.” “.$arg;
                }

                fputs($this->sock, $cmd.”\r\n”);
                $this->smtp_debug(“> “.$cmd.”\n”);

                return $this->smtp_ok();
        }

        function smtp_error($string)
        {
                $this->log_write(“Error: Error occurred while “.$string.”.\n”);
                return FALSE;
        }

        function log_write($message)
        {
                $this->smtp_debug($message);

                if ($this->log_file == “”) {
                        return TRUE;
                }

                $message = date(“M d H:i:s “).get_current_user().”[".getmypid()."]: “.$message;
                if (!@file_exists($this->log_file) || !($fp = @fopen($this->log_file, “a”))) {
                        $this->smtp_debug(“Warning: Cannot open log file \”".$this->log_file.”\”\n”);
                        return FALSE;
                }
                flock($fp, LOCK_EX);
                fputs($fp, $message);
                fclose($fp);

                return TRUE;
        }

        function strip_comment($address)
        {
                $comment = “\\([^()]*\\)”;
                while (ereg($comment, $address)) {
                        $address = ereg_replace($comment, “”, $address);
                }

                return $address;
        }

        function get_address($address)
        {
                $address = ereg_replace(“([ \t\r\n])+”, “”, $address);
                $address = ereg_replace(“^.*<(.+)>.*$”, “\\1“, $address);

                return $address;
        }

        function smtp_debug($message)
        {
                if ($this->debug) {
                        echo $message.”<br>”;
                }
        }

        function get_attach_type($image_tag) { //

                $filedata = array();

                $img_file_con=fopen($image_tag,”r”);
                unset($image_data);
                while ($tem_buffer=AddSlashes(fread($img_file_con,filesize($image_tag))))
                $image_data.=$tem_buffer;
                fclose($img_file_con);

                $filedata['context'] = $image_data;
                $filedata['filename']= basename($image_tag);
                $extension=substr($image_tag,strrpos($image_tag,”.”),strlen($image_tag)-strrpos($image_tag,”.”));
                switch($extension){
                        case “.gif”:
                                $filedata['type'] = “image/gif”;
                                break;
                        case “.gz”:
                                $filedata['type'] = “application/x-gzip”;
                                break;
                        case “.htm”:
                                $filedata['type'] = “text/html”;
                                break;
                        case “.html”:
                                $filedata['type'] = “text/html”;
                                break;
                        case “.jpg”:
                                $filedata['type'] = “image/jpeg”;
                                break;
                        case “.tar”:
                                $filedata['type'] = “application/x-tar”;
                                break;
                        case “.txt”:
                                $filedata['type'] = “text/plain”;
                                break;
                        case “.zip”:
                                $filedata['type'] = “application/zip”;
                                break;
                        default:
                                $filedata['type'] = “application/octet-stream”;
                                break;
                }
                return $filedata;
        }

}
?>

继续阅读 »

返回顶部