In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Xiaobian to share with you what SAE development considerations in ThinkPHP, I believe most people do not know how, so share this article for your reference, I hope you have a lot of harvest after reading this article, let's go to understand it together!
The details are as follows:
ThinkPHP SAE development is basically the same as the standard version of ThinkPHP. You don't need to know the SAE interface usage. ThinkPHP SAE engine has automatically integrated SAE interfaces for you. As long as you master ThinkPHP development, you can easily master SAE development based on ThinkPHP.
Here are some considerations we have given for the SAE engine development process to help you better complete SAE development and deployment.
configured
The SAE engine runtime has SAE's own convention configuration and proprietary configuration, so the configuration file loading order is:
Convention Configuration-> Project Configuration->SAE Convention Configuration->SAE Proprietary Configuration
Configuration items in SAE convention configurations and SAE proprietary configurations override project configurations.
SAE convention configuration: Located in the engine directory/Sae/Convention/convention_sae.php, it defines database connection configuration items that are fixed when the program runs on SAE.
SAE proprietary configuration: Located in the Conf directory of the project, the file name is config_sae.php, where you can write SAE specific configuration.
Note: SAE convention configurations and SAE proprietary configurations are unique configurations for SAE environments and will not be loaded when running locally.
database
Developers do not need to define database configuration items related to SAE in the project configuration file (config.php), just need to define the database connected during local debugging. Code submitted to SAE runs without modifying any configuration items because SAE convention configuration automatically overrides database configuration in your project configuration file.
Code runs on SAE with distributed database connections and read/write separation.
cache
During SAE development, you can still use ThinkPHP's built-in caching methods. Here are the differences between SAE engine caching methods used locally and SAE platforms (note that SAE engine automatically determines this difference):
Cache method locally runs SAE platform S cache by default using File method and fixed Memcache implementation, so the DATA_CACHE_TYPE configuration item will be invalid under SAE. If you need to use the Mecache service provided by SAE, you can directly use the S function to F cache using File implementation using KVDB to implement static caching to generate static Html files. Static files are stored in KVDB. SQL queues support File, Xcache and APC storage using KVDB.
The new version of ThinkPHP supports SQL cache queue function, we can configure DB_SQL_BUILD_CACHE to enable SQL statement parsing cache. KVDB is used to store SQL cache under SAE platform, so DB_SQL_BUILD_QUEUE configuration item will not work. And when running under SAE, Counter service will be used to record the number of SQL cache queues. In Counter's management background,
http://sae.sina.com.cn/? m=counter
If you see that the calculator name think_queue_out_times has a large value, it means that the number of queues you set is too small, and you need to adjust the DB_SQL_BUILD_LENGTH configuration item.
file upload
File uploads still use the UploadFile extension class library to upload files, using the same method. The same code will be uploaded to the specified directory when running locally, and will automatically upload files to the specified Storage using the Storage service when running on SAE. First you need to create a Storage domain on SAE platform to store uploaded files:
http://sae.sina.com.cn/? m=storage
Multiple domains can be created here. The domain to which our files will be uploaded is determined by the first directory name of the upload path. For example:
$upload->savePath = './ Public/Uploads/';
It will be uploaded to a domain named Public. You don't have to create an Uploads folder under this domain either, SAE's Storage service will create it for you automatically.
Problem with picture address:
We use the UploadFile class to upload images, and the browsing address of images in local and SAE is different. For example, there is a picture address of "/Public/upload/1.jpg",/Public is a template replacement variable, it will be replaced with the address of the directory where the Public folder is located, we can view the source code function of the browser to see what effect is replaced. The requested URL/Public/upload/1.jpg was not found on this server. But on SAE, the images are not in the Public/upload directory, but in storage. We need to replace/Public/with the domain name of storage to display properly on SAE.
We define the following code in the SAE proprietary configuration Conf/config_sae.php file:
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.