Login
Close

RESTful API interface design specification

Apps

In development work, we sometimes need to provide an API interface for clients or third parties to use, so how to build an API that users can quickly understand is an important task. If we strictly abide by some specifications when designing APIs, communication costs and efficiency will be greatly improved in the subsequent development process. Let’s talk about the design specifications of RESETful API today.
RESTful API interface design specification

Front-end CryptoJS AES/DES encryption and decryption and back-end PHP AES/DES encryption and decryption

PHP Scripts

Today we will focus on front-end encryption. Some projects involve more sensitive data, and developers will require the front end to encrypt the data before transmitting it to the back end for decryption processing. Although https has actually played a great role in protecting data transmission, for users who do not use https, front-end encryption still has a certain significance.
Front-end CryptoJS AES/DES encryption and decryption and back-end PHP AES/DES encryption and decryption

This article involves:
The front end uses CryptoJS to encrypt and decrypt DES or AES data;
The backend uses PHP openssl to decrypt and encrypt the data.

Use front-end Javascript download file

Javascript

There is often a need to export data to Excel during project development, or to download documents. The simplest way to download is to directly request the file address of the server and download the file through the browser http. But in development, due to project requirements, the address of the file you want to download will not be exposed to the user, and authentication is required to allow the download of the file. What should we do at this time?
Use front-end Javascript download file

NProgress.js-page loading progress bar

Javascript / Plugins

NProgress.js provides a page loading progress bar effect. When the page opens and loads, a progress bar loading animation will appear at the top of the page. NProgress.js is a lightweight progress bar component that is easy to use and can be easily integrated into single-page applications.
NProgress.js-page loading progress bar

Directly quote the nprogress.js and nprogress.css files to your page.

PHP errors and exception handling

PHP Scripts

Unlike other programming languages ​​that throw exceptions when encountering errors, PHP also has an exception mechanism when handling objects, but PHP will perform as happily as possible and ignore what happened, unless it encounters an extremely serious error. There is an exception. This article outlines PHP-related error exception handling mechanisms.
PHP errors and exception handling

PHP has several error severity levels. The three most common types of information are errors, notices, and warnings. They have different severity: E_ERROR, E_NOTICE and E_WARNING. The error is a serious problem during operation, usually caused by code error, it must be corrected, otherwise PHP will stop execution. Notifications are information of a recommended nature, because the program code may cause problems during execution, but the program will not stop. The warning is a non-fatal error, and program execution will not be aborted.

Using fetch for asynchronous requests in JavaScript

Javascript

In the AJAX era, network requests such as APIs are made through XMLHttpRequest or encapsulated frameworks. The fetch framework now produced is simply to provide more powerful and efficient network requests. Although there are currently a few browser compatibility issues, when we make some asynchronous requests, we can use fetch to make perfect network requests.
Using fetch for asynchronous requests in JavaScript

8 common pitfalls in JavaScript

Javascript

javascript uses alphanumeric to sort by default. Therefore, the result of [1,2,5,10] .sort () is [1, 10, 2, 5]. If you want to sort correctly, you should do this: [1,2,5,10] .sort ((a, b) => a-b)
8 common pitfalls in JavaScript

javascript uses alphanumeric to sort by default. So the result of [1,2,5,10] .sort () is [1, 10, 2, 5].

Microsoft officially ends support for Windows 7

Internet

Finally, with the arrival of January 14, 2020, the ten-year-old Windows 7 operating system has officially retired. Starting today, Microsoft will officially discontinue support for Win7, which means that users can still use this classic operating system normally, but Microsoft will no longer perform any reason and update.
Microsoft officially ends support for Windows 7

Microsoft stated that "after January 14, 2020, Microsoft will no longer provide security upgrades or support for computers with Windows 7 installed." Windows 7 was born in 2009, and it has been more than 10 years. 10 years of maintenance, so the impact of this outage is not small.

Delete Google Blogger's default CSS and JS

CSS

When we use Google Blogger, we will find that even if we use a custom domain name, the page content also contains CSS and JS files from the Google Blogger domain. Since the domain name is inaccessible from the country, it will slow down the website access speed, in order to speed up the website loading speed. It is necessary to delete the CSS and JS files loaded by the system by default. Let me tell you how to delete these CSS and JS.
Delete Google Blogger's default CSS and JS

Go to the Google Blogger background, click on "Themes", select the current theme, select "Modify HTML", and enter the HTML source code modification interface.

PHP and UTF-8

PHP Scripts

When working with the Unicode character set, use the corresponding function instead of the native string function. For example, if a file is encoded as UTF-8 PHP code, if the strlen() function is wrong, use the mb_strlen() function instead.
PHP and UTF-8

If you use substr to intercept Chinese characters, garbled characters will appear, because substr is intercepted in bytes. That is, UTF-8 encoded Chinese, using substr interception, will only intercept 1/3 Chinese, of course, garbled. When UTF-8 is encoded, a Chinese character is 3 bytes. Similarly, different languages in other countries will produce multi-byte strings, so we use mb_strlen() to handle them.
Previous Next

Shortcut