公益圖書館-基本環境搭建及代碼規範

來源:互聯網
上載者:User

標籤:style   http   color   使用   strong   檔案   

注意:使用設定檔時一定要先備份一份,取名:name-backup.conf

公益圖書館平台

 一、環境搭建篇:

1.修改apache中預設的專案檔夾

在httpd.conf中修改DocumentRoot "XXX/htdocs"  為  DocumentRoot "E:/Source/PhpStorm"  //修改伺服器預設路徑<Directory "XXX/htdocs"> 為 <Directory "E:/Source/PhpStorm">  //修改目錄

2.添加apache對php檔案的解析

(下載的php版本應該是VC6 X86 thread safe否則沒有php5apache2_2.dll檔案)在httpd.conf中修改#LoadModule vhost_alias_module modules/mod_vhost_alias.so在下一行添加 (引號中的位置根據PHP的所在目錄而定的,如果php就在apache根目錄則如下)LoadModule php5_module "php/php5apache2_2.dll"   //載入php解析模組,使apache能夠自動解析php檔案PHPIniDir "php"AddType application/x-httpd-php .php .html .htm  //使其能夠解析php、html、htm檔案

3.為方便本地測試,添加一個虛擬機器主機

a.在C:\Windows\System32\Drivers\etc\hosts檔案最後添加(如果儲存時提示不能修改,hosts->屬性->安全->編輯 全打上勾)    127.0.0.1 www.siyuan.com    127.0.0.1 siyuan.com//當瀏覽器輸入www.siyuan.com時,會從hosts中擷取IP 127.0.0.1,即自動轉入到本地的虛擬機器主機上,進入虛擬機器主機中設定的DocumenRoot預設路徑,同時顯示DirectoryIndex的預設網頁(如果存在的話,否則發生404 not found錯誤)。b.httpd.conf檔案中開啟注釋 Include conf/extra/httpd-vhosts.conf//在apache伺服器中添加虛擬機器主機c.在extra/httpd-vhosts.conf檔案中添加如下配置:    <VirtualHost *:80>        DocumentRoot "E:/Source/PhpStorm/SiYuan"  //該虛擬機器主機的預設路徑,當瀏覽器訪問www.siyuan.com時預設進入該目錄        ServerName siyuan.com        ServerAlias *.siyuan.com        <Directory "E:/Source/PhpStorm/SiYuan">              DirectoryIndex index.html index.php  //虛擬機器主機的歡迎介面            Options Indexes FollowSymLinks            AllowOverride all            Order allow,deny            Allow from all        </Directory>        ErrorLog "logs/siyuan.com-error.log"        CustomLog "logs/siyuan.com-custom.log" common    </VirtualHost>d.重啟apache伺服器

4.開啟apache網域名稱重新導向

在httpd.conf中開啟注釋LoadModule rewrite_module modules/mod_rewrite.so所有的AllowOverride均改為All

5.php.ini中開啟對mysql的支援

開啟注釋:extension=php_mysql.dllextension=php_mysqli.dll//如果沒有效果的話,還需要如下這般寫:(寫出全路徑)extension=D:/Program/Apache/php/ext/php_mysql.dllextension=D:/Program/Apache/php/ext/php_mysqli.dll註:查看生效方法,phpinfo();頁面中查看是否有mysqli這一個欄目 //輸入www.siyuan.com,會自動進入E:/Source/PhpStorm/SiYuan裡的index.html,只要修改它,添加<?php  phpinfo();  ?>即可。
//使用SQL:
//1、開啟系統服務 運行 services.msc ,啟動MySql程式;
//2、添加環境變數,MySql的bin目錄;
//3、直接命令列運行 mysql -u root -p,然後輸入密碼
//4、innoxyzyj退出用exit即可。

5.php.ini中開啟對imagecreate()函數的支援,方便繪製驗證碼。

開啟注釋:extension=php_gd2.dll//如果不生效還需寫出全路徑extension=D:/Program/Apache/php/ext/php_gd2.dll註:查看生效方法,phpinfo();頁面中查看是否有gd這一個欄目

6.在phpStorm添加對Less檔案的支援。

a.下載安裝nodejsb.安裝less: 在nodejs的控制台中輸入:    npm install -g lessc.在phpStorm中 File->setting                ->File Water->Less(可能需要點擊+,添加Less)                ->Edit->Program指定為                C:\Users\XXX\AppData\Roaming\npm\lessc.cmd

7.添加XDebug模組。

a.下載對應的XDebug.dll檔案,放置到php/ext目錄下b.在php.ini檔案中添加如下結點:    [xdebug]    zend_extension = D:/Program/Apache/php/ext/php_xdebug-2.2.5-5.4-vc9.dll    xdebug.remote_enable=onc.在phpStorm中Edit Configurations    添加一個PHP Web Application    添加一個Server.

8.phpStorm中添加對git的支援。

a.下載gitb.在phpStorm中指定git.exe位置c.VCS->Enable Version Control Integration

9.對Mysql做的相應設定:

a.Workbench->Edit->preference->SQL Queries->"Safe Updates".Forbid 不打勾

二、代碼規範篇:

1.項目後端架構採用ThinkPHP3.2.2

官方網站:http://www.thinkphp.cn/學習手冊:http://document.thinkphp.cn/manual_3_2.html特別提醒:在開發過程中請勿擅自修改/ThinkPHP下的任何代碼,如果實在需要修改請徵求我的意見。並且在第三篇中添加上修改說明。

2.項目前端架構採用bootstrap3.2

官方網站:http://getbootstrap.com/中文網站:http://www.bootcss.com/特別提醒:開發過程中請勿擅自修改/Public/css/Bootstrap3.2.0,/Public/js/bootstrap.js, /Public/js/bootstrap.min.js下任何代碼,如果確實需要修改,請徵求我的意見,並且在第三篇中添加修改說明。

3.JQuery採用1.11.1版本

官方網站:http://jquery.com/

4.表單驗證採用Validform

官方網站:http://validform.rjboy.cn/在需要進行驗證的form表單中添加屬性 data-validate="true"即可。需要驗證的格式請參考Validform官網文檔。

三、修改說明篇:

1.對ThinkPHP架構的修改:

a.添加自訂html標籤    在/ThinkPHP/Library/Think/Template/TagLib下添加Sy.class.php檔案b.修改驗證一次就刪除session的問題    在E:\Source\PhpStorm\SiYuan\ThinkPHP\Library\Think\Verify.class.php添加$delete變數。

2.對Bootstrap架構的修改:

a.重新指定字型資源檔案:    在/Public/css/Bootstrap3.2.0/variables.less中修改如下:    @icon-font-path:          "../fonts/";    改為    @icon-font-path:          "/Public/fonts/";

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.