APICloud使用


APICloud-APP開發平台

[網址:]http://www.apicloud.com/

APICloud studio 下載

  • 打開網址,找到開發者社區->文檔->下載->開發工具(工具:APICloud Studio)

  • 下載AppLoader,安裝到手機(分為安卓和ios兩種,掃碼安裝即可,網站上有二維碼)

  • 打開開發控制台->創建應用(生成證書)

通過APICloud studio 登錄連接雲端

  • 登錄studio后將雲端資源庫檢出到我的 APP 項目

  • 配置 config.js var YAH_web= 'http://192.168.1.134';(若有端口號記得填寫端口號),可通過studio的幫助查看服務器地址

wampserver的配置

  • 配置httpd.conf(改配置是讓局域網內其他的設備可以訪問改服務器,注意:必須是局域網內;也可以常試去配置多站點,這樣wamp便會有多個工作目錄了)

[解決方案]http://www.aichengxu.com/php/5397.htm

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Order deny,allow
    Allow from all
    Satisfy all
</Directory>

    #
    # Note that from this point forward you must specifically allow
    # particular features to be enabled - so if something's not working as
    # you might expect, make sure that you have specifically enabled it
    # below.
    #

<Directory "F:/wamp/wamp/www/">
    #
    # Possible values for the Options directive are "None", "All",
    # or any combination of:
    #   Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
    #
    # Note that "MultiViews" must be named *explicitly* --- "Options All"
    # doesn't give it to you.
    #
    # The Options directive is both complicated and important.  Please see
    # http://httpd.apache.org/docs/2.4/mod/core.html#options
    # for more information.
    #
    Options Indexes FollowSymLinks

    #
    # AllowOverride controls what directives may be placed in .htaccess files.
    # It can be "All", "None", or any combination of the keywords:
    #   AllowOverride FileInfo AuthConfig Limit
    #
    AllowOverride all

    #
    # Controls who can get stuff from this server.
    #

    #onlineoffline tag - don't remove
    Order Deny,Allow
    Allow from all
</Directory>
  • php連接數據庫配置
<?php
/*
 * 配置連接數據庫信息
 */
//$pz=include"../system/modules/member/lib/user_fufen.ini.php";
header('Content-type:text/html;charset=utf-8');
$host='127.0.0.1';//主機
$user='root';//數據庫賬號
$password='';//數據庫密碼
$database='dshshop';//數據庫名
$WEB_PATH='http://127.0.0.1';//服務器域名
//打開數據庫連接
$db=mysqli_connect($host,$user,$password,$database);
//判斷連接是否成功
if($db){
	$db->query("set names utf8");//設置UTF-8編碼(JSON的唯一編碼)
}else{
	echo 'DATABASE_CONNECTION_DIE';//數據庫連接失敗
	exit;
}
$oto='oto';
error_reporting(E_ALL^E_NOTICE);


$YAH_web="http://127.0.0.1";
require('function.php');
?>
  • 通過phpMyAdmin 將數據導入數據庫 (編碼格式utf8_general_ci)

  • js便可以通過異步請求訪問后台了,后台數據來自於數據庫

AppLoader的使用(根據不同的系統安裝不同版本,ios\android)

  • 打開軟件后輸入服務器地址、端口(可通過studio工具的幫助功能查看)

  • 通過studio wifi真機同步后便可以在手機端查看了(移動端、PC端必須在同一局域網內部)

項目學習

  • 將雲端項目通過studio檢出到我的APP項目

  • 接下來便可以通過APICloud生成的項目Demo進一步模仿學習了

  • 最后的最后,js是通過api對象的ajax方法異步請求后台數據的,后台會返回json格式數據


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM