在Xamarin中使用PHP / Mysql进行登录并重定向到另一个XAML

我刚开始使用Xamarin。现在,我已经学习了如何创建跨平台应用程序。但是现在我很担心。我想从输入框中获取输入

这是我的XAML的样子:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="Qasimapp.Page1"
             BackgroundColor="#fff">
    <ContentPage.Content>

        <StackLayout Spacing="20" Padding="50" VerticalOptions="Center">
            <Image Source="slim_logo.png" x:Name="logom" HeightRequest="100" WidthRequest="100"/>
            <Entry Placeholder="username"></Entry>
            <Entry Placeholder="Password" IsPassword="True"></Entry>
            <Button Text="Log In" TextColor="White" BackgroundColor="#ff77D065"></Button>
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

并使用WebAPI或常规PHP API之类的方法连接到数据库,并重定向到其他形式,例如仪表板。这是我的PHP样子

<?php
require_once('inc/config.php');

$con = mysqli_connect($host,$user,$pass,$db) or die ('Cannot Connect to Database'.mysqli_error());

$username = mysqli_real_escape_string($con,$_POST['userID']);
$passwd = mysqli_real_escape_string($con,$_POST['passwd']);
$designation = mysqli_real_escape_string($con,$_POST['designation']);


$query = "SELECT * FROM evmsdbusers WHERE username='$username' AND password='$passwd' and designation='$designation'";
$result = mysqli_query($con,$query);

if (mysqli_num_rows($result) == 1) {

if($designation == 'User')
    {
        saveLoginLogs();
    }
    else if($designation =='Security')
    {
        saveLoginLogs();
    }
}

?>

例如,现在我已将其上传到http://32.125.23.120/login.php上的服务器上,我想使用它通过XAML跨平台登录

如何实现这样的目标?如何进行身份验证,然后重定向到我想要的主页?我对这样的东西很陌生,我所有的搜索都证明是失败的。

yychuan123456 回答:在Xamarin中使用PHP / Mysql进行登录并重定向到另一个XAML

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3117277.html

大家都在问