Mac下MAMP初試體驗

來源:互聯網
上載者:User


原創文章,轉載請註明出處!

最近小學習了一下Mac下的Apache,Mysql,php。這裡記錄一下,以備忘

1 php1.1 php返回值的測試

     在MAMP下測試成功,直接echo返回所資料

1.2 php調試環境
  • 用komodo這個IDE可以斷點調試一些東西,但機器上安裝好之後,不能Debug,

Failed to configure for local php debugging

  • 還是用emacs編輯,
  • 在Terminal裡,簡單看一下文法問題。
  • 在chrome裡,或通過項目上調試內容
1.3 php對protobuff對象解析
  • protobuf庫依賴

require_once(PRO_ROOT.'/message/pb_message.php');

  • 商務邏輯庫依賴

require_one(PRO_ROOT.'/message_proto/pb_protohbcommand.php');

  • 讀取請求資料

$l_requestContent = file_getcontents("php://input");

  • 構造對象

$l_requestCommand = new RequestCommand();

  • 填充內容

$l_requestCommand->parseFromString($l_requestContent);

  • 解析欄位

echo($l_request->loginRequest()->user_data()->user_id());

2 mysql2.1 mamp中mysql命令

alias mysql='/Applications/MAMP/Library/bin/mysql'

2.2 mysql命令2.2.1 Remove this Database

if(mysql_num_rows(mysql_query("show databases like '"."test_database"."'"))==1){

drop database test_database;

}

2.2.2 Create New Database

create database test_database;

2.2.3 Create Table.....


相關文章

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.