PHP code example of jiangwang / amis-schema

1. Go to this page and download the library: Download jiangwang/amis-schema library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jiangwang / amis-schema example snippets


// 使用全局函数和链式调用
$page = ais()->Page()
    ->title('用户管理')
    ->subTitle('系统用户管理页面')
    ->body([
        ais()->Form()->body([
            ais()->InputText()->name('username')->label('用户名'),
            ais()->Button()->label('提交')->type('submit')
        ])
    ]);

use AmisSchema\Widget\Layout\Page;
use AmisSchema\Widget\Function\Button;

$page = Page::make()
    ->title('我的页面')
    ->body([
        Button::make()->label('点击我')
    ]);

// 使用 Flutter 风格的全局函数,参数更直观
$page = AmisPage(
    title: '用户管理',
    body: [
        AmisForm(
            title: '搜索条件',
            body: [
                AmisInputText(
                    name: 'keywords',
                    label: '关键字',
                    placeholder: '请输入关键字'
                ),
                AmisSelect(
                    name: 'status',
                    label: '状态',
                    options: [
                        ['label' => '启用', 'value' => 1],
                        ['label' => '禁用', 'value' => 0]
                    ]
                ),
                AmisButton(
                    label: '搜索',
                    actionType: 'submit',
                    level: 'primary'
                )
            ]
        )
    ]
);