本文整理汇总了PHP中Data::FromJson方法的典型用法代码示例。如果您正苦于以下问题:PHP Data::FromJson方法的具体用法?PHP Data::FromJson怎么用?PHP Data::FromJson使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data::FromJson方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: login
function login()
{
if ($username == null) {
echo "E-Mail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/Login.php";
$httpClient_post = new httpClient();
$inputMetodo = new InputText();
$inputMetodo->setValue("login");
$httpClient_post->addVariable('username', $username);
$httpClient_post->addVariable('password', $password);
$result = $httpClient_post->Execute('POST', $url);
$id_user = new InputText();
$struct = array("response" => DataType::Character(50));
Data::FromJson($struct, $result);
$id_user = $struct['response'];
ProgressIndicator::Hide();
if ($id_user != "0") {
StorageAPI::Set("token", $id_user);
AndroidAction::GoHome();
} else {
echo "Wrong user or password";
}
}
}
}
示例2: login
function login()
{
if ($email == null) {
echo "E-Mail is a required field.";
} else {
if ($pass == null) {
echo "Password is a required field.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=login";
$httpClient_post = new httpClient();
$httpClient_post->addVariable('email', $email);
$httpClient_post->addVariable('password', $pass);
$result = $httpClient_post->Execute('POST', $url);
$customerToken = new InputText();
$userName = new InputText();
$response = array("customerToken" => DataType::Character(150), "userName" => DataType::Character(150));
Data::FromJson($response, $result);
$customerToken = $response['customerToken'];
$userName = $response['userName'];
ProgressIndicator::Hide();
if ($customerToken != "") {
StorageAPI::Set("token", $customerToken);
StorageAPI::Set("userName", $userName);
AndroidAction::GoHome();
} else {
echo "Invalid user";
}
}
}
}
示例3: save
function save()
{
if ($username == null) {
echo "E-Mail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
if ($password != $password2) {
echo "Please make sure your passwords match.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/updateUser.php";
$httpClient_post = new httpClient();
$inputMetodo = new InputText();
$inputMetodo->setValue("login");
$httpClient_post->addVariable('username', $username);
$httpClient_post->addVariable('password', $password);
$httpClient_post->addVariable('id', $token);
$result = $httpClient_post->Execute('POST', $url);
$id_user = new InputText();
$struct = array("response" => DataType::Character(50));
Data::FromJson($struct, $result);
$id_user = $struct['response'];
ProgressIndicator::Hide();
AndroidAction::GoHome();
}
}
}
}
示例4: save
function save()
{
if ($email == null) {
echo "EMail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
if ($password != $password_2) {
echo "Please make sure your passwords match.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/Gastos/crud/Register.php";
$http = new httpClient();
$http->addVariable('username', $email);
$http->addVariable('passcode', $password);
//lo de pasar la clave a md5 lo hace el Register.php
$result = $http->Execute('POST', $url);
$struct = array("id_usuario" => DataType::Character(101));
Data::FromJson($struct, $result);
$id_user = new InputText(100);
$id_user = $struct['id_usuario'];
if ($id_user == "0") {
echo "User already signed up";
} else {
echo "Signed up succesfully.";
StorageAPI::Set("token", $id_user);
AndroidAction::GoHome();
}
}
}
}
}
示例5: load_data
function load_data()
{
$url = "http://www.devxtend.com/Gecko/samples/3_2/rest/main_load_data";
$hc = new httpClient();
$rs = $hc->Execute("GET", $url);
$struct = array(array("id" => DataType::Character(6), "name" => DataType::Character(100)));
Data::FromJson($struct, $rs);
}
示例6: load_cat
function load_cat()
{
$url = "http://demo.kikapptools.com/Gastos/crud/getCategories.php";
$hc = new httpClient();
$rs = $hc->Execute("GET", $url);
$struct = array(array("idCat" => DataType::Numeric(11), "name" => DataType::Character(80), "desc" => DataType::Character(200)));
Data::FromJson($struct, $rs);
}
示例7: loadCity
function loadCity()
{
$url = "http://demo.kikapptools.com/HttpClientEjemplo/crud/getCity.php";
$httpClient = new httpClient();
$result = $httpClient->Execute('GET', $url);
$struct = array("nombreCiudad" => DataType::Character(150));
Data::FromJson($struct, $result);
$city = $product['nombreCiudad'];
}
示例8: clientStart
function clientStart()
{
$token = StorageAPI::Get("token");
$url = "http://demo.kikapptools.com/Gastos/crud/getAccount.php";
$httpClient = new httpClient();
$httpClient->addVariable("id", $token);
$result = $httpClient->Execute('POST', $url);
$struct = array("money" => DataType::Numeric(11));
Data::FromJson($struct, $result);
$input = $struct['money'];
}
示例9: load_grid
function load_grid()
{
$url = "http://demo.kikapptools.com/magento/apiKikApp/Categories.php?cId=" . $cat;
$httpClient = new httpClient();
$result = $httpClient->Execute('GET', $url);
$struct = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150)));
Data::FromJson($struct, $result);
foreach ($struct as $product) {
$id = $product['id'];
$name = $product['name'];
}
}
示例10: start
function start()
{
$url = "http://demo.kikapptools.com/CRMManager/crud/getCompanies.php?companyId=" . $id;
$httpClient = new httpClient();
$result = $httpClient->Execute('GET', $url);
$struct = array("CompanyName" => DataType::Character(100), "CompanyImage" => DataType::Character(200), "CompanyPhone" => DataType::Phone(), "CompanyAddress" => DataType::Address());
Data::FromJson($struct, $result);
$image = $struct['CompanyImage'];
$name = $struct['CompanyName'];
$address = $struct['CompanyAddress'];
$phone = $struct['CompanyPhone'];
}
示例11: load_image
function load_image()
{
$url = "http://demo.kikapptools.com/magento/apiKikApp/ProductImages.php?pId=" . $id;
$httpClient = new httpClient();
echo $id;
$result = $httpClient->Execute('GET', $url);
$str_images = array(array("url" => DataType::Character(350)));
Data::FromJson($str_images, $result);
foreach ($str_images as $img) {
$image = $img['url'];
}
}
示例12: load_images
function load_images()
{
$url = "http://demo.kikapptools.com/magento/apiGecko/productos.php?cId=0";
$httpClient = new httpClient();
$result = $httpClient->Execute('GET', $url);
$struct = array(array("id" => DataType::Numeric(6), "name" => DataType::Character(150), "description" => DataType::Character(300), "pirce" => DataType::Character(10), "thumb" => DataType::Character(200)));
Data::FromJson($struct, $result);
foreach ($struct as $product) {
$id = $product['id'];
$title = $product['name'];
$desc = $product['description'];
$image = $product['thumb'];
}
}
示例13: load_companies
function load_companies()
{
$url = "http://demo.kikapptools.com/CRMManager/crud/getCompanies.php";
$httpClient = new httpClient();
$result = $httpClient->Execute('GET', $url);
$struct = array(array("CompanyId" => DataType::Numeric(8), "CompanyName" => DataType::Character(100), "CompanyImage" => DataType::Character(200), "CompanyAddress" => DataType::Character(200)));
Data::FromJson($struct, $result);
$id = new InputNumeric();
foreach ($struct as $company) {
$id = $company['CompanyId'];
$image = $company['CompanyImage'];
$name = $company['CompanyName'];
$address = $company['CompanyAddress'];
}
}
示例14: save
function save()
{
ProgressIndicator::Show();
$request = new httpClient();
$request->addVariable('taskID', $id);
$request->addVariable('status', $status);
$request->addVariable('task', $name);
$request->addVariable('imagen', $imagen);
$result = $request->Execute('POST', "http://52.34.247.215/frameWorkExamples/taskManager/crud/updateTask.php");
$sdtError = array("response" => type::Character(100));
Data::FromJson($sdtError, $result);
$rsValue = new InputText(100);
$rsValue = $sdtError['response'];
ProgressIndicator::Hide();
$win->Open("main");
}
示例15: save
function save()
{
if ($name == null) {
echo "Name is a required field.";
} else {
if ($lastname == null) {
echo "Last name is a required field.";
} else {
if ($email == null) {
echo "E-Mail is a required field.";
} else {
if ($password == null) {
echo "Password is a required field.";
} else {
if ($password != $password_2) {
echo "Please make sure your passwords match.";
} else {
ProgressIndicator::Show();
$url = "http://demo.kikapptools.com/magento/apiKikApp/api.php?metodo=createUser";
$http = new httpClient();
$http->addVariable('name', $name);
$http->addVariable('lastname', $lastname);
$http->addVariable('email', $email);
$http->addVariable('password', $password);
$rs = $http->Execute("POST", $url);
$sdt_rs = array("error" => DataType::Character(300));
Data::FromJson($sdtError, $rs);
$rs = new InputText(300);
$rs = $sdt_rs['error'];
ProgressIndicator::Hide();
if ($rs == "0") {
echo "User created successfully!";
$win->Open("Login");
} else {
echo $rs;
}
}
}
}
}
}
}