當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crud::create方法代碼示例

本文整理匯總了PHP中Crud::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crud::create方法的具體用法?PHP Crud::create怎麽用?PHP Crud::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crud的用法示例。


在下文中一共展示了Crud::create方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 function save()
 {
     if (!empty($_POST['username']) && !empty($_POST['password'] != '')) {
         $username = $_POST['username'];
         $password = $_POST['password'];
         // Load the CRUD
         require ROOT . '/justit-php-test/models/crud.php';
         $register_user = new Crud();
         if (isset($_POST)) {
             // Start building array
             $user_data = array('firstname' => $_POST['firstname'], 'lastname' => $_POST['lastname'], 'username' => $_POST['username'], 'password' => md5($_POST['password']));
             if ($new_id = $register_user->create($user_data)) {
                 include 'views/register-success.php';
             }
         }
     } else {
         // Return back to the login
         $this->error_message = "Please fill out the form";
         $this->index();
     }
 }
開發者ID:acutedeveloper,項目名稱:justit-php-test,代碼行數:21,代碼來源:register.php

示例2: Crud

<!DOCTYPE HTML>
<html>
	<head>
		<title>Create Php</title>
	</head>
	<body>
	<?php 
include_once 'model.php';
if (isset($_POST['submit'])) {
    $name = $_POST['name'];
    $address = $_POST['address'];
    $phone = $_POST['phone'];
    $gender = $_POST['gender'];
    $insertData = new Crud();
    $insertData->create($name, $address, $phone, $gender);
    header("Location: read.php");
}
?>
	<form action="" method="POST">
		<div>
			<label>Name :</label>
			<input type="text" name="name" />
		</div>
		<div>
			<label>Address:</label>
			<input type="text" name="address" />
		</div>
		<div>
			<label>Phone:</label>
			<input type="text" name="phone" />
		</div>
開發者ID:ocpyosep78,項目名稱:basicCrudInPhp,代碼行數:31,代碼來源:create.php

示例3: edit

 public function edit($id)
 {
     return Crud::create($id);
 }
開發者ID:csgt,項目名稱:components,代碼行數:4,代碼來源:crudController.php

示例4: create

 /**
  * Over-rides Crud create
  *
  */
 public function create()
 {
     $this->data['pageKeys'] = $this->_pages->getStorableKeys();
     return Crud::create();
 }
開發者ID:cybercog,項目名稱:exambuff,代碼行數:9,代碼來源:script.php

示例5: htmlspecialchars

    $codigo = htmlspecialchars($_POST['codigo']);
    $descripcion = htmlspecialchars($_POST['descripcion']);
    $categoria = htmlspecialchars($_POST['categoria']);
    $precio = htmlspecialchars($_POST['precio']);
    if (!is_numeric($precio)) {
        $mensaje = "El campo precio deber ser numerico";
    } elseif ($codigo == "") {
        $mensaje = "Error el campo codigo es requerido!";
    } elseif ($descripcion == '') {
        $mensaje = "Error el campo descripcion es requerido";
    } else {
        $model = new Crud();
        $model->insertInto = 'Productos';
        $model->insertColumns = 'Codigo, Descripcion, Categoria, Precio';
        $model->insertValues = "'{$codigo}','{$descripcion}', '{$categoria}', {$precio}";
        $model->create();
        $mensaje = $model->mensaje;
    }
}
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv ="content-type" content = "text/html; charset = UTF-8">
</head>
<body>
	<h1>CRUD CREATE: Productos </h1>
	<strong><?php 
echo $mensaje;
?>
 </strong>
開發者ID:avillapena,項目名稱:curso-php,代碼行數:31,代碼來源:crear.php

示例6: test_create

 /** @expectedException \Exception */
 public function test_create()
 {
     /** === Call and asserts  === */
     $this->obj->create([]);
 }
開發者ID:praxigento,項目名稱:mobi_mod_mage2_core,代碼行數:6,代碼來源:Crud_Test.php


注:本文中的Crud::create方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。