Agile Web Application Development with Yii 1.1 and PHP5 phần 3

Bạn đang tại dấu nhắc trong vỏ tương tác. Bạn có thể gõ giúp để xem một danh sách các lệnh có sẵn cho bạn trong vỏ này: Tại dấu nhắc, bạn có thể nhập một tuyên bố PHP hoặc một trong các lệnh sau đây: - crud - bộ điều khiển hình thức giúp đỡ mô hình - mô-đun Loại 'giúp đỡ' cho các chi tiết về một lệnh. | Chapter 4 This assumes that a MySQL database has been created called trackstar_dev and is available to connect to the localhost IP of 12 . One of the great benefits of making this an application component is that from now on we can reference the database connection simply as a property of the main Yii application Yii app - db anywhere throughout our application. Similarly we can do this for any of the components defined in the config file. All of our examples will be using the MySQL database. However we will be providing the low-level DDL statements for the table structures and we will try to keep things generic from a database implementation perspective. It is entirely possible to follow along using any Yii-compatible database of your choice. At the time of writing Yii has Active Record support for MySQL PostgresSQL SQLite SQL Server and Oracle. The charset property set to utf8 sets the character set used for database connection. This property is only used for MySQL and PostgreSQL databases. We are setting it here to ensure proper utf8 unicode character support for our PHP application. The emulatePrepare true configuration sets a PDO attribute PDO ATTR_EMULATE_PREPARES to true which is recommended if you are using PHP or higher. So we have specified a MySQL database called trackstar_dev as well as the username and password needed to connect to this database. We did not show you how to create such a database in MySQL. We assume you have a favorite database you are going to use as you follow along and know how to create a new database. Please refer to your specific database documentation if you are unsure of how to create a new database called trackstar_dev and define a username and password for connectivity. Once the database is in place we can test it again by running our unit test again phpunit unit PHPUnit by Sebastian Bergmann. Time 0 seconds OK 1 test 1 assertion Our test now passes 59 Iteration 1 Creating the Initial Trackstar .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
2    838    2    27-06-2024
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.