軟件藝術(shù)思考者  
          混沌,彷徨,立志,蓄勢...
          公告
          日歷
          <2008年1月>
          303112345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          導(dǎo)航

          隨筆分類(86)

          隨筆檔案(85)

          搜索

          •  

          最新評論

          閱讀排行榜

          評論排行榜

           

          1.php中文亂碼:原來php也是有中文編碼問題的。例如Db使用的是utf-8,頁面一般使用gbk的,那么在寫入數(shù)據(jù)的時(shí)候要先轉(zhuǎn)換成utf-8.iconv('utf-8','gbk',sourceStr),mysql_query('set names utf8'),取出的時(shí)候簡單一些,mysql_query('set names gbk');
          2.php的時(shí)間.php.ini里有DateZone設(shè)置,如果這里沒有設(shè)置,在取時(shí)間的時(shí)候會晚8個(gè)小時(shí),
          也可以在程序里使用date_default_timezone_set('PRC');來臨時(shí)設(shè)置.
          3.有些php環(huán)境里還是不會自動解析變量的。所以還需要我們親自寫$_request('變量名');但寫的時(shí)候不能寫重復(fù)了。否則會出錯

          posted on 2007-10-16 10:41 智者無疆 閱讀(686) 評論(11)  編輯  收藏 所屬分類: phpStudy
          評論:
          • # re: PHP使用記錄  老婆 Posted @ 2007-10-16 11:01
            嗯,像這樣的記錄每天都要寫,每天都要有進(jìn)步!!呵呵  回復(fù)  更多評論   

          • # c homework[未登錄]  lijun Posted @ 2007-10-24 12:35
            #include "stdio.h"
            main()
            {char str1[100],str2[100];
            char c;
            int i=0,j=0,k,m,n;
            printf("\nplease input a $ (0-99):\n");
            while((c=getchar())!='\n'&&i<99&&j<99)
            { if(c>=48&&c<=57)
            str1[i++]=c ;
            else if(c>=65&&c<=90||c>=97&&c<=122)
            str2[j++]=c ;
            else ;
            }
            for(k=1;k<i;)
            {for(m=k-1;m>=0;m--)
            {if(str1[k]==str1[m])
            { for(n=k+1;n<i;n++)
            str1[n-1]=str1[n];
            i--;
            break;
            }
            else if(str1[k]>str1[m])
            { char tempch=str1[k];
            for(n=k-1;n>m;n--)
            str1[n+1]=str1[n];
            str1[m+1]=tempch;
            k++;
            break;
            }
            else ;
            }
            if(m==-1)
            { char tempch=str1[k];
            for(n=k-1;n>=0;n--)
            str1[n+1]=str1[n];
            str1[0]=tempch;
            }
            }
            for(k=1;k<j;)
            { for(m=k-1;m>=0;m--)
            { if(str2[k]==str2[m])
            { for(n=k+1;n<j;n++)
            str2[n-1]=str2[n];
            j--;
            break;
            }
            else if(str2[k]>str2[m])
            { char tempch=str2[k];
            for(n=k-1;n>m;n--)
            str2[n+1]=str2[n];
            str2[m+1]=tempch;
            k++;
            break;
            }
            else ;
            }
            if(m==-1)
            { char tempch=str2[k];
            for(n=k-1;n>=0;n--)
            str2[n+1]=str2[n];
            str2[0]=tempch;
            }
            }
            str1[i]='\0';
            str2[j]='\0';
            printf("the number array: %s\n",str1);
            printf("the letter array: %s\n",str2);
            return(1);
            }  回復(fù)  更多評論   

          • # 離散 homework[未登錄]  lijun Posted @ 2007-10-24 12:39
            http://www.sou88.com/lszy.jpg  回復(fù)  更多評論   

          • # 周末工作檢查[未登錄]  lijun Posted @ 2007-10-27 10:40
            1.ChannelStatsController,productStatscontroller方法清掃。。
            function channel() {
            mysql_query("set names gb2312");
            $channals = $this->Channal->findAll();
            $this->set("channals1",$channals);}
            2.UserStatsDataController
            。。。top。。。//10
            mutiSubTypeTablesOnAction($subType[$i],$this->getOrderbyStrByActionId($doingString),$doingString,10);//10
            print_r->//print_r
            3.product.php echo->//echo
            4.channal.thtml.product.thtml

            <iframe name='display'scroll=no;scrolling='no'; height=900px; frameBorder='false' style='width:800px; border-width:0 0 0 0;overflow:hidden;overflow-y:hidden;overflow-x:hidden;border:0px;'
            ></iframe>  回復(fù)  更多評論   

          • # php 連接,創(chuàng)建數(shù)據(jù)庫,創(chuàng)建表[未登錄]  lijun Posted @ 2007-11-08 10:05
            通過PHP連接MYSQL數(shù)據(jù)庫


            $conn = mysql_connect("localhost","root","password") or die("無法連接數(shù)據(jù)庫");
            mysql_select_db("table" ,$conn) or die ("找不到數(shù)據(jù)源");


            -----------------------------------------------------------------------
            通過PHP創(chuàng)建MYSQL數(shù)據(jù)庫

            $conn = mysql_connect("localhost","root","password") or die("無法連接數(shù)據(jù)庫");
            mysql_create_db("webjx") or die("無法創(chuàng)建數(shù)據(jù)庫");
            $sqlstr = "create database other_webjx";
            mysql_query($sqlstr) or die("無法創(chuàng)建,一般請檢查權(quán)限什么的");

            ----------------------------------------------------------------------------
            創(chuàng)建mysql的表

            $conn = mysql_connect("localhost","root","password") or die("無法連接數(shù)據(jù)庫");
            mysql_select_db("webjx",$conn) or die("無法連接數(shù)據(jù)庫webjx");
            $sql = "create table webjx_table(
            ids integer not null auto_increment ,
            primary key(ids)
            )";
            $mysql_query($sql) or die(mysql_error());   回復(fù)  更多評論   

          • # Apache不能啟動[未登錄]  lijun Posted @ 2007-11-10 18:27
            當(dāng)apache也向我們提示ssl服務(wù)的時(shí)候會一起啟用80和443端口,這時(shí),如果有些軟件先于apache使用了80或者443端口的時(shí)候就會造成apache啟用失敗。
            在window的事件查看器里我們可以看到這樣的提示:通常每個(gè)端口只能使用一次。mack_sock:can not bind to address:0,0,0,0:443.好了,有這樣的信息我們就可以安圖索驥,先查看誰在占用端口才443。方法是:在dos下用netstat -ano查看哪個(gè)進(jìn)程使用了這個(gè)端口,記下pid號。然后在任務(wù)管理器里點(diǎn)查看選擇列,勾選上 pid,就能找到使用這個(gè)端口的程序了。kill it .over.
            但是如果使用443的程序很重要,我們也可以修改apahe的端口。
            去apahe/conf/http.conf修改80
            或者去apache/cof/ext/ssl.conf下面找到使用443端口的配置,修改成其他端口號即可。  回復(fù)  更多評論   

          • # Apache不能啟動[未登錄]  lijun Posted @ 2007-11-10 18:29
            通常我們在使用mode_rewirte或者使用apache和tomcat橋接的時(shí)候,apache會啟用ssl服務(wù)。  回復(fù)  更多評論   

          • # loadrunner[未登錄]  lijun Posted @ 2007-11-18 14:25
            [free_guru].rar|318419889|D4216029A35112019952F905278E30BF|h=3YVYJNIKXOYHC7RM5TQ7MXA7GBXRP4YG|/RP4YG|  回復(fù)  更多評論   

          • # java內(nèi)存溢出[未登錄]  lijun Posted @ 2007-12-03 12:30
            eclipse:啟動參數(shù)
            D:\eclipse\eclipse.exe -clean -Xms256m-Xmx768m-XX:PermSize=256M-XX:MaxPermSize=512M
            tomcat 操作程序參數(shù):在config Server 里面配置。
            -xms 512m -xmx 1024m
            如果它們?nèi)魏我粋€(gè)參數(shù)不設(shè)置,都可能造成內(nèi)存溢出  回復(fù)  更多評論   

          • # re: PHP使用記錄[未登錄]  lijun Posted @ 2008-01-10 21:35
            06 12 14 18 23 30
            03
              回復(fù)  更多評論   

          • # bake 幫我們生成腳手架代碼  zhanglijun Posted @ 2008-03-01 17:29
            如何使用bake.php
            bake.php是一種快速生成m-v-c的工具,當(dāng)然也可以進(jìn)行數(shù)據(jù)庫的連接配置(在第一運(yùn)行的時(shí)候)

            在windows 的dos命令行的狀態(tài)下,php bake.php 命令是無法運(yùn)行的,我們需要添加xampp下的php目錄到我的電腦-屬性-高級-環(huán)境變量-系統(tǒng)變量-path 下, D:\Program Files\xampp\php;

            ** 為了簡便運(yùn)行bake.php, 可以在桌面建立一個(gè)快捷方式,目標(biāo)為cmd, 起始位置為"D:\Program Files\xampp\htdocs\cake\cake\scripts" 這樣方便我們直接使用bake.php

            當(dāng)?shù)谝淮螖?shù)據(jù)庫連接成功之后,他會取得當(dāng)前的表單,你就可以按照提示,進(jìn)行m-v-c的自動生成了,例如association helpers

            當(dāng)然多數(shù)的功能還是要自己動手寫的,但是對于一些常用的功能,bake.php可以幫助我們快速建立相關(guān)的m-v-c文件,整個(gè)文件結(jié)構(gòu),我們所需要做的就是在這個(gè)基礎(chǔ)之上進(jìn)行修改,省去了建立文件夾,建立相關(guān)文件的麻煩。

            附注說明:
            嘗試CakePHP的bake功能。

            先安裝一個(gè)能運(yùn)行的CakePHP,然后把相應(yīng)的路徑添加到系統(tǒng)的PATH環(huán)境變量里去(比如:C:\Program Files\Apache Group\Apache2\htdocs\cake\cake\console),然后,在命令行(cmd)里進(jìn)入相應(yīng)的工作目錄(比如:C:\Program Files\Apache Group\Apache2\htdocs\cake\app),就可以使用bake功能來生成代碼了。具體命令是:cake bake,然后會有簡單的提示,你只要對著做就可以了。

            使用bake來生成常用功能。

            最簡單的方法是使用腳手架方式,當(dāng)你bake控制器的時(shí)候,系統(tǒng)會先問“Would you like bake to build your controller interactively?”,選擇是,然后系統(tǒng)問“Would you like to use scaffolding?”,你只要回答是就搞定了。不過這樣的腳手架是動態(tài)的,我們沒法修改程序和模板,如果你想生成實(shí)實(shí)在在的代碼,以bake控制器為例:當(dāng)系統(tǒng)問“Would you like bake to build your controller interactively?”的時(shí)候,選擇否(也可以選擇是,然后在系統(tǒng)問“Would you like to use scaffolding? ”時(shí)再選擇否就可以了),然后系統(tǒng)會接著問“Would you like to include some basic class methods (index(), add(), view(), edit())? ”,這時(shí)候選擇是,就會生成實(shí)實(shí)在在的控制器代碼了,相應(yīng)的視圖代碼bake方法雷同。通過看這些bake出來的代碼,也可以加深我們對cakephp用法的了解,代碼片段如下:


            復(fù)制內(nèi)容到剪貼板代碼:
            function add() {
            if (!empty($this->data)) {
            $this->cleanUpFields();
            $this->model->create();
            if ($this->model->save($this->data)) {
            $this->Session->setFlash('The model has been saved');
            $this->redirect(array('action'=>'index'), null, true);
            } else {
            $this->Session->setFlash('The model could not be saved. Please, try again.');
            }
            }
            }
              回復(fù)  更多評論   


          只有注冊用戶登錄后才能發(fā)表評論。


          網(wǎng)站導(dǎo)航:
           
           
          Copyright © 智者無疆 Powered by: 博客園 模板提供:滬江博客


             觀音菩薩贊

          主站蜘蛛池模板: 偃师市| 措美县| 太仆寺旗| 伊川县| 綦江县| 灵璧县| 汕头市| 闽清县| 定陶县| 双峰县| 清水县| 肇东市| 丹阳市| 东阳市| 浏阳市| 自治县| 塘沽区| 南投市| 临泽县| 红安县| 缙云县| 吉木萨尔县| 翁牛特旗| 出国| 六枝特区| 通城县| 都安| 阳谷县| 孟连| 都昌县| 泸水县| 辽阳县| 大渡口区| 阿鲁科尔沁旗| 泗水县| 南乐县| 仪陇县| 宣威市| 天全县| 富平县| 昭苏县|