APICloud-APP开发平台
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格式数据