亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

? ? ????? JS ???? Axios ? ??? ?? ??? ???? ??? ????? ?? ?? ??? ??

Axios ? ??? ?? ??? ???? ??? ????? ?? ?? ??? ??

Nov 02, 2024 pm 08:54 PM

Building a Robust Frontend Error-Handling System with Axios and Custom Hooks

??

???? ?? ??? ??? ??? ??? ???? ???? ?? ??? ??? ???? ? ?????. ??? ???????? ?? ?? ??? ?? ??? ???? ???? ??? ????? ???? ?? ??? ????. ? ?????? ??? ????? ????? ???? ??? ??? ?? Axios, ??? ??(useApi) ? ??? ??? ???? ???? React?? ???, ?? ?? ? ?? ??? ?? ?? ???? ???? ??? ?????.

Hook: ?? ??? ?? ??? ??? ??

????? ???? ???? ??? ??? ???. ?? ?? ??? ??? API?? ???? ???? ? ?? ??? ???? ??, ?? ??, ??? ??? ?? ? ??? ??? ??? ? ????. ?? ??? ?? ?? ???? ??? ???? ?? ???? ?? ??? ????? ???? ???? ?? ???? ?? ???. ???? ??? ??? ??? ???? ?? ? ????? ??? ???? ? ????? ? ?????? ??? ??????.

???? ?? ??? ??? ???.

  • Axios ????? ???? ?? ??? ?? ??? ???? ??
  • API ?? ??? ???? ?? ??? ?? useApi ??? ??
  • ??? ??? ???? API ??? ??? ?? ??
  • ??? ??, ?? ?? ? ??? ???? ?? ??? ?? ?? ?????.

??

  1. ? ?? ??? ?? ??? ??????
  2. ?? ??
  3. ????? ???? Axios ???? ??
  4. ??? Api Hook ???
  5. ????? ?? ??? ??
  6. ??? ?? ??
  7. ?: ??? ???
  8. ?? ?? ??(?? ??)
    • ??? ?? ?? ?? ??
    • ??? ????
    • ?? ??
    • ???? ??? ?? ?? ??
  9. ? ??
  10. ??? ??
  11. ?? ??: ?? ??
  12. ?? ??
  13. ?? ??
  14. ????
  15. ????
  16. ??
  17. ?? ??

? ?? ??? ?? ?????

?? ??? ?? ??? ? ?? ???? ??? ?????.

???? ?? ??

  • ??: ?? ????? ??? ?? ??? ?? try-catch ??? ?????.
  • ??: ??? ?? ?? ?? ? ?? ??? ?????.

???? ?? ??? ??

  • ??: ?? ???? ?? ??? ?? ??? ?? ? ????.
  • ??: ??? ??? ??? ??? ????? ??? ? ? ????.

Axios ????, ??? ?? ??(useApi) ? ??? ??? ?? ?? ??? ?? ??? ???? ??? ?? ??? ??? ??? ? ????.

  • ?? ?? ?? ? ???? ?? ?? ??: ???? ????? ?? ??? ??? ? ?? ??? ??? ?????.
  • ?? ?? ??: ?? ??? ??? ?? ? ??? ?? ???? ??? ? ??? ?? ?? ??? ?? ??? ??? ????.

?? ??

????? ???? Axios ???? ??

Axios ????? Axios? ?? ?? ?? ??? ?? ???? ?????. ?? ????? ???? ????? ??? ????, ??? ?? ????, ?? ??? ?? ???? ????? ?????? ?? ??? ??? ? ????.

1??: ??? ?? ????

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

2??: Axios ???? ??

const axiosInstance = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || '',
  headers: {
    'Content-Type': 'application/json',
  },
});

3??: ?? ???? ??

axiosInstance.interceptors.response.use(
  (response) => response, // Pass through successful responses
  (error) => {
    if (!error.response) {
      toast.error(ERROR_MESSAGES.NETWORK_ERROR);
      return Promise.reject(error);
    }

    const { status, data } = error.response;
    let message = ERROR_MESSAGES[status] || ERROR_MESSAGES.GENERIC_ERROR;

    // Custom logic for specific error types
    if (data?.type === 'validation') {
      message = `Validation Error: ${data.message}`;
    } else if (data?.type === 'authentication') {
      message = `Authentication Error: ${data.message}`;
    }

    // Display error notification
    toast.error(message);

    // Handle unauthorized access by redirecting to login
    if (status === 401) {
      Router.push('/login');
    }

    return Promise.reject(error);
  }
);

??:

  • ?? ?? ??: ????? ??? ??? ??? ?????. ??? ?? ?? ???? ??? ???? ?? ???? ?????.
  • ??? ?? ?? ???: ???? ???? ?? ??? ?? ??? ?? ?? ???? ????? ?????. ??? ? ?? ???? ??? ?? ??? ???? ?????.
  • ??? ???: React-toastify? ???? ??? ??? ???? ???? ???? ???? ??? ??? ?????.
  • ????: 401 Unauthorized ??? ??? ?? ???? ??? ???? ?????? ?? ???? ???? ??? ?????.

4??: Axios ???? ????

export default axiosInstance;

??? ?? ?? ???

???? ?? ???? ????? ??? ?? ??? ??? ?? ?? ???? ?????.

// config/customErrors.js

const ERROR_MESSAGES = {
  NETWORK_ERROR: "Network error. Please check your connection and try again.",
  BAD_REQUEST: "There was an issue with your request. Please check and try again.",
  UNAUTHORIZED: "You are not authorized to perform this action. Please log in.",
  FORBIDDEN: "Access denied. You don't have permission to view this resource.",
  NOT_FOUND: "The requested resource was not found.",
  GENERIC_ERROR: "Something went wrong. Please try again later.",

  // You can add more messages here if you want
};

export default ERROR_MESSAGES;

?? ??: Axios ???? ??

Axios ???? ??? ??? ?????.

  • ?? ??? ?? ?? ??: ??? ? ??? ???? ?? API ??? ?? ???? ?????.
  • ??? ???: React-toastify? ???? ??? ?? ????? ?? ????.
  • ???? ? ??: ??? ? ???? ?? ???? ?????? ?????? ?? ???? ?????.

? ?? ??? Axios ????? ?? API ??? ??? ??? ?????? ??? ?? ??? ???? ????? ??? ???? API ?? ??? ???? ? ?????.

??? ?? useApi ?? ??

useApi ??? API ?? ??, ??, ??? ? ?? ?? ??? ?? ??????. useApi? ? ????? ??????? ????? ???? try-catch ??? ??? ??? ??? ??? ? ??? ???.

????:

  • apiFunc(??): ????? ??? ???? ??? API ?????.
  • immediate(??, ?? ??): ?? ??? ? ?? API ??? ???? ??? ??? ?????. ???? false???.

??? ?:

  • data: API ??? ?? ???
  • loading: API ??? ?? ??? ??? ?????.
  • ??: ??? API ??? ?? ?? ???? ?????.
  • ??: API ??? ???? ???, ??? ????? ??? ? ????.

??:

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

??:

  • ?? ??:
    • data: ?? ???? ?????.
    • loading: API ??? ?? ??? ?????.
    • ??: ?? ???? ?????.
  • ?? ??:
    • API ??? ?????.
    • API ?? ??? ?? ?? ????? ?????.

??? ?? ?? ????

? ??? ???? ?? JavaScript? ??? ?? ??? ???? ?? ?????. JavaScript? API ??? ?? ??? ??? ???? ? ???? ??? ?? ?????.

  • Promise: Promise? ??? ??? ?? ?? ?? ??? ???? ?????. ??? ??(??) ?? ??(??)? ???? ?? ??? ??? ? ????.
  • Promise Rejection: ??? ???? Promise? "??"?? .catch ??? ?? .then? ? ?? ????? ??????.

Axios ? useApi? ???:

  • Axios ? Promises: Axios? Promises? ???? HTTP ??? ?????. Axios? ???? ???? ?? ???? ????? ??? ?? ???? Promise? ?????.
  • Axios ????? Promise ??: Axios ?????? ??? ???? ????? Promise.reject(error)? ???? Promise? ?????. ? ??? API ??? ???? ??? ?????.
  • useApi?? ?? ??: useApi ??? ?? ??? try-catch? ???? ??? ??? ?????. apiFunc(...args)? ???? catch ??? ??? ???? ?? ?? ?? ??? ???????.

?? ?? ??? ???:

  • ???? ?? ?? ??: Promise ??? ???? ??? ??? ?? ??? ???? ???? ???? ? ????.
  • ???? ?? ??: Promise ?? ??? ?? ??????? ?? ??? ???? ????? ???? ?? ???? ??? ??? ??????.

useApi Hook? ???? ??? ??? ????

useApi ??? ??? API ??? ???? ?? ?? ??? try-catch ??? ???? ???. ? ?? ??? ??? ?? ??? ?????.

  • ?? ??: ? ?? ??? ??? ?? ?? ??? ???? ?? ???? ?????.
  • ???? ?? ?? ??: ?? ???? ??? ??? ???? ???? ?? ??? ??? ??? ? ????.
  • ?? ?? ?? ??: ?? ?? ??? ??????? ?? ?? ??? ???? ??? ?? ??? ???????.

useApi ??? ???? ???? ?? ?? ??? ????? ? ???? ?? ???? ?? ??? ?? ? ????.

?? ?:

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

? ??? useApi ??? ??? ???? ?? API ??? ?????. ?? ??? ???? ??? ???? ???? ?? ??? ???? ?? ??? ?????.


??? ?? ??

??? ??? ??(?: ???, ??)?? ??? API ????? ??? ?????. ? ??? API ??? ?? ?? ??? ???? ??? ? ???? ?????.

?: ?? ???

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

?: ??? ???

const axiosInstance = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || '',
  headers: {
    'Content-Type': 'application/json',
  },
});

??? ??? ??:

  • ??? ? ??? ???: API ??? ?? ?? ???? ???? ? ?? ?? ??? ?????.
  • ?? ?? ??: API ??? ???? ???? ?? ??? ???? ???? ?? ?? ? ?? ???? ?????.
  • ? ??? ???: ??? ??? ????? ????? ?? ??? ???? ?? API ?? ??? ???? ????? ??? ? ????.

?? ?? ??(?? ??)

?? ?? ???? ?? ?????? ?? ??? ?? ?? ?? ??? ??? ???.

??? ?? ?? ?? ? ??? ??????.

??? ????(?: ???? ? ??) ?? ??? ???? ???? ???? ??? ??? ?? ??? ???? ? ??? ???.

??:

axiosInstance.interceptors.response.use(
  (response) => response, // Pass through successful responses
  (error) => {
    if (!error.response) {
      toast.error(ERROR_MESSAGES.NETWORK_ERROR);
      return Promise.reject(error);
    }

    const { status, data } = error.response;
    let message = ERROR_MESSAGES[status] || ERROR_MESSAGES.GENERIC_ERROR;

    // Custom logic for specific error types
    if (data?.type === 'validation') {
      message = `Validation Error: ${data.message}`;
    } else if (data?.type === 'authentication') {
      message = `Authentication Error: ${data.message}`;
    }

    // Display error notification
    toast.error(message);

    // Handle unauthorized access by redirecting to login
    if (status === 401) {
      Router.push('/login');
    }

    return Promise.reject(error);
  }
);

??:

  • ?? ??: ????? ?? ??? ?? ??? ???? ??? ??(?: ??? ?? ?? ??)? ?????.
  • ?? ??? ???: ????? ?? ??? ?? ???? ?? ???? ???? ???? ??? ??? ?? ??? ??????.

??? ????

UI? ??? ???? ?? ???? ?? ?? ??? ? ??? ??? ?? ??? ??? ???? ???? ????.

??:

export default axiosInstance;

??:

  • ???: ?? ??? ??? ???? ??? ??? ?? 3??? ?????? Axios? ?????.
  • ??? ??: ???? ??, ??? ?? ?? ??? 500 ?? ?? ??? ???? ?? ???? ?????.
  • ??? ??: ? ??? ??? ???? ?? ??? ? ????? ??? ? ????.

?? ??

???? ??? ???? ??? ? ??? ???(??, ??, ??)?? ??? ??????.

??:

// config/customErrors.js

const ERROR_MESSAGES = {
  NETWORK_ERROR: "Network error. Please check your connection and try again.",
  BAD_REQUEST: "There was an issue with your request. Please check and try again.",
  UNAUTHORIZED: "You are not authorized to perform this action. Please log in.",
  FORBIDDEN: "Access denied. You don't have permission to view this resource.",
  NOT_FOUND: "The requested resource was not found.",
  GENERIC_ERROR: "Something went wrong. Please try again later.",

  // You can add more messages here if you want
};

export default ERROR_MESSAGES;

??:

  • ?? ??: ?? ????? ?? ??? ?? ??(??, ??, ??)? ?????.
  • ??? ???: ????? ??? ???? ???? ??? ???? ??? ???? ? ??? ???.

???? ??? ?? ?? ??

?? ??? ??? ???? ?? ?? ??? ???? ??? ??? ????? Axios ?? ??? ?????.

??:

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

??:

  • ?? ??: ? ??? ????? ?? ??? ??? ??? ? Axios ?? ??? ???? ?? ?? API ??? ?????.
  • ??? ?? ??: ??? ??? ?? ???? ?? ????? ???? ??? ?? ???? ??? ??? ?????.
  • ??? ?? ??: ??? ???? ??? ??? ?????.

?? ?? ?? ??

??? ?? ??? ???? ?? ?? ???? ? ?? ? ??? ? ????.

  • ?? ?? ?? ??? ??: ????? ?? ???? ?? ???? ???? ???? ??? ?? ???? ??? ? ??? ????.
  • ??? ????: ?? ??? ??? ? ?? ?? ???? ??? ?????? ???? ???? ?????.
  • ?? ??: ?? ??? ???? ???? ?? ??? ???? ????? ? ?? ??? ?????.
  • ???? ??? ?? ?? ??: ??? ?? ? ?? ??? ???? ????? ???? ? ??? ?????.

??? ?? ??? ?? ????? ?? ?? ?? ?? ??? ??, ??? ? ??? ?? ?? ??? ????? ?? ??? ????.


??? ????

????? useApi? ?? API ??? ???? ?? ??? ??????.

?? ?? ?? ??? ??:

? ??? ??(?: userService, productService)? ?? API ?????? ?? ??? ???? ??? axiosInstance? ?????. ?? ??? ??? ??? ???? ?? ?????.

useApi? ??? ??? ?? Axios? ??????.

????? useApi? ??? ??(?: productService.getProducts)? ?????. ??? ???? useApi? ??? ???? ??? ?? axiosInstance? ?? HTTP ??? ?????.

Axios ????? ??? ?? ?? ?? ??:

axiosInstance? ????? ?? ??? ???? ?? ??? ??? ?? ?? ???? ?? ???? ?? ??? ?? ??????.

useApi? ???? ??:

useApi? ???? ??(???, ?? ? ??)? ?? ??? ????? ??? ?? ? ?? ?? ???? ??? ? ????.


??? ??

?? ????? ?? API ???? ??? ????? ?? ?? ???? ? ?? ??? ?????? ??? ?? ???? ??? ?????.

  1. ????

    • ?? ??? API ?? ??, ?? ??, ?? ??? ???? ????? useApi ??? ???? API ??? ?????.
  2. Api Hook ??

    • useApi? (??? ????) API ??? ?? ??? ???? ??? ?? ?????. ??? ?? ??? ????, ??? ????, ???? ??(???, ??, ??)? ?? ??? ?? ?????.
  3. ??? ??

    • ??? ??? ? API ?????(?: getProducts, createProduct)? ?? ?? ??? ???? ?? ??? ???? ?? ??? axiosInstance? ???? ?????? ???? ???? ?????.
  4. Axios ????

    • axiosInstance? ?? URL ? ??? ?? ??? ?? ??? ???? HTTP ?? ? ??? ?????.
  5. API ??

    • API? ??? ????? ??? ???? Axios ????? ?? ?????. ???? ??? ?? ?? ??? ?? ?? ? ??? ?? ???? ?????.
  6. ?? ?? ? ??? ??

    • ????? ??-toastify ??? ?? ????? ?? ???? ????, ?? ?? ? ???? ??? ???? ?????? ?? ?? ??? ??? ? ????.

? ??? ???? ?? ??? ?? ??? ??? ??? ???? ?? ?? ??? ???? ?? ?? ??? ??? ?? ?? ??? ???? ??? ? ????.


?? ?? ??? ??: ?? ??

ProductList ?? ??

? ???? ?? ??? ?? ?? ? ???? ?? API ???? ??? ???? ?? ??? ?????.

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

?? ?? ??:

  • ?? ???:

    • React-toastify: ??? ??? ???? ? ?????.
    • productService : ??? ??? API ??? ?? ????.
    • useApi: API ?? ??? ?? ??? ?? ??
  • ?? ???:

    • productService? getProducts ??? ???? useApi ??? ??????. false ????? ?? ??? ? API ??? ?? ???? ??? ?? ?????.
  • API ?? ???:

    • useEffect? ???? ?? ??? ???? ? ?? ??? ???? ??? ? ?? ???? ?????.
  • ?? ??:

    • ? ?? useEffect? ?? ??? ??? ?????. ??? ???? ??? ??? ????? ????? ????.
  • ??? ???:

    • ?? ??: API ??? ???? ?? ?? ???? ?????.
    • ?? ??: API ??? ??? ?? ?? ???? ?????.
    • ??? ???: ???? ????? ???? ???, ?? ? ??? ??? ?? ???? ??????.

? ???? ?? ??? ?? ??? ?? ?? ??? ????? ??? ??? ???? ???? ??? ?????.


?? ??

?? ??? ???? ?? ?? ???? ????? ?? ??? ???? ??? ????? ???.

????? ??

  • ??: ??? ??? ???? API ??? UI ?? ??? ??? ?????. ?? ?? ?? ??? ?? ???? ?????.
  • ?: ?? ?? ??? ?? API ??? ???? ?? productService.js? ?? ??? ??? ?????.

??? ?? ???

  • ??: ?? ??? ???? ???? ???? ????? ??? ??? ??? ?????.
  • ?: customErrors.js? ?? ??? ?? ???? ???? ??? ??? ??? ???? ???? ??? ???? ?? ? ????.

???? ?? ???

  • ??: ?? ??? ?? ?? ? ??? ?? ??? ???? ?? ?? ???? ???? try-catch ??? ?????.
  • ?: useApi ??? ?? ??? ??? ???? ?? ??? ??? ????? ??? ? ??? ???.

?? ?? ?? ???

  • ??: ??? ????? ?? ??? ?? ???? ???? ???? ??? ???? ????.
  • ?: "??? ??????."? ?? ???? ???? ???? ?? "?? ??: ??? ??? ??? ?????."? ?? ?? ???? ?????.

?? ??? ??

  • ??: ???? ??, ?? ?? ? ??? ?? ??? ???? ???? ?????? ??? ?????.
  • ?: Axios ????? "???? ??" ???? ???? ?????? ??? ???? ???? ??? ?????.

??? ?? ??

  • ??: ?? ???? ??? ??? ???? ??? ???. ??? ??? ??? ???? ????? ??? ???? ???? ?????.
  • ?: ???? Sentry? ?? ?? ???? ??? ?? ??? ??? ?? ????? ???? ?? ???? ?????.

?? ??

?? ???? ?? ? ????? ??? ??? ?? ??? ????.

  • Axios ???? ??: Axios ????? ???? ??? ??? ????? ???? ??? ?????.
  • React Hooks ??: ?? ? ??? ??? ?? React Hooks? ?? ??? ?????.
  • Redux Toolkit ??: React ??????? ???? ?? ??? ?? Redux Toolkit? ?????.
  • React-Toastify ??: ? ?? ??? ???? ?? ??? ??? ???? ??? ?????.

?? ??

1. ??? ??? ???? ??

  • ??: React-toastify? ?? ??? ??????? ????? ? ????.
  • ???: ?? ?????? ?? ??(????? ???/_app.js)? ???? ????.
// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

2. ????? ???? ??? API ??

  • ??: ??? ??? ?? ??? axiosInstance ?? ?? Axios ?????? ??? ? ????.
  • ???: ?? ??? ??? ?? ??? axiosInstance? ????? ?????.
const axiosInstance = axios.create({
  baseURL: process.env.NEXT_PUBLIC_API_BASE_URL || '',
  headers: {
    'Content-Type': 'application/json',
  },
});

3. ?? ??? ?? ????? ???? ??

  • ??: next/router? ???? ??? ???? ??? React ?? ?? ???? ???? ?? ? ????.
  • ???: ???? ????? ??? ? ?? ?????? Axios ????? ????? ?????. ?? useApi ?? ?? ?? ?? ??? ????? ?????.

?? ??

??? ??? ???? ??, ???, ?? ?? ??????? ??? API ?????? ?? ??? ? ????.

1??: ?? ?? ??

????? ?? ????? .env.local ??? ???? API ?? URL? ?????.

axiosInstance.interceptors.response.use(
  (response) => response, // Pass through successful responses
  (error) => {
    if (!error.response) {
      toast.error(ERROR_MESSAGES.NETWORK_ERROR);
      return Promise.reject(error);
    }

    const { status, data } = error.response;
    let message = ERROR_MESSAGES[status] || ERROR_MESSAGES.GENERIC_ERROR;

    // Custom logic for specific error types
    if (data?.type === 'validation') {
      message = `Validation Error: ${data.message}`;
    } else if (data?.type === 'authentication') {
      message = `Authentication Error: ${data.message}`;
    }

    // Display error notification
    toast.error(message);

    // Handle unauthorized access by redirecting to login
    if (status === 401) {
      Router.push('/login');
    }

    return Promise.reject(error);
  }
);

2??: ???? ?? ??? ???

Axios ????? ?? ??? ????? ?????.

// utils/axiosInstance.js
import axios from 'axios';
import ERROR_MESSAGES from '../config/customErrors';
import { toast } from 'react-toastify';
import Router from 'next/router';

?? ??:

  • ??? ?? ??: .env.local ???? ??? ?? ??? ?? ?? ???? ???? ???. ??? ??? ????? .gitignore? ?????.
  • ???? ?? ??: ?? ??? ?? ???? ??? ??? ?????. ????? ?????? ????? ?? ???? ?? NEXT_PUBLIC_ ???? ????.
  • ? ??? ?? ?? ??: ??? ????? ????? ??? ??(?: .env.development, .env.production)? ?? ??? .env ??? ???????.

??

?? ??? ?? ?? ???? ?????? ??? ??? ??? ???? ?? ????? ???? ????? ??? ???? ??? ??????. ?? ? ????? ?? ?? ??? ????? ?? ? ?? ??? ??????? ?? ??? ? ?? ??? ??? ?????.

???? ???? ????? ?? ??? ??? ????? ??? ??? ??? ?? ??? ??? ????. ?? ??? ?? ?? ??? ?? ??? ??????? ???? ?? ??? ??? ??? ???? ?????.


?? ??

?? ??? ?? ??? ?? React/Next.js ??????? ??? ??? ?????

? ??? ??, ??? ??? ??, ??? ?? ?? ??? ????? ? ???? ??? ??? ?????.

???? ?????

???? ?? ??, ??, ??? ???? ??? ???? GitHub ? Twitter? ???? ????? ?????.

? ?? ??? ?????

?? ?? ??? ?? ?? ???? ???? npm ???? ???? ????. ????? ?? ??? ???? ????? ???? ??? ??? ????!

??? ?????! ??

? ??? Axios ? ??? ?? ??? ???? ??? ????? ?? ?? ??? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? ????? ??
? ?? ??? ????? ???? ??? ??????, ???? ?????? ????. ? ???? ?? ???? ?? ??? ?? ????. ???? ??? ???? ???? ??? ?? admin@php.cn?? ?????.

? AI ??

Undresser.AI Undress

Undresser.AI Undress

???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover

AI Clothes Remover

???? ?? ???? ??? AI ?????.

Video Face Swap

Video Face Swap

??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

???

??? ??

???++7.3.1

???++7.3.1

???? ?? ?? ?? ???

SublimeText3 ??? ??

SublimeText3 ??? ??

??? ??, ???? ?? ????.

???? 13.0.1 ???

???? 13.0.1 ???

??? PHP ?? ?? ??

???? CS6

???? CS6

??? ? ?? ??

SublimeText3 Mac ??

SublimeText3 Mac ??

? ??? ?? ?? ?????(SublimeText3)

???

??? ??

??? ????
1597
29
PHP ????
1488
72
NYT ?? ??? ??
132
836
???
??? ??? JavaScript?? ??? ?????? ??? ??? JavaScript?? ??? ?????? Jul 04, 2025 am 12:42 AM

JavaScript? ??? ?? ????? ??? ?? ??? ??? ?? ?? ?? ????? ?? ???? ???? ?????. ??? ?? ???? ?? ??? ?? ??? ???? ???? ?? ?? ???? ???? ?????. ?? ??, ??? ? ?? ???? ??? (? : ??? null? ??) ?? ??? ????? ??????. ??? ??? ???? ??? ??? ????. closure?? ?? ??? ?? ??; ? ??? ??? ?? ?? ???? ?? ???? ????. V8 ??? ?? ???, ?? ??, ??/?? ???? ?? ??? ?? ??? ??? ????? ?? ??? ?? ??? ????. ?? ?? ???? ??? ??? ??? ??? ???? ????? ?? ?? ???? ?? ???????.

node.js?? HTTP ????? ??? node.js?? HTTP ????? ??? Jul 13, 2025 am 02:18 AM

Node.js?? HTTP ??? ???? ? ?? ???? ??? ????. 1. ?? ????? ????? ??? ??? ? ?? ????? ?? ?? ? https.get () ??? ?? ??? ??? ? ?? ????? ?? ??? ?????. 2.axios? ??? ???? ? ?? ??????. ??? ??? ??? ??? ??? ??? ???/???, ?? JSON ??, ???? ?? ?????. ??? ?? ??? ????? ?? ????. 3. ?? ??? ??? ??? ??? ???? ???? ??? ??? ???? ?????.

JavaScript ??? ?? : ?? ? ?? JavaScript ??? ?? : ?? ? ?? Jul 13, 2025 am 02:43 AM

JavaScript ??? ??? ?? ?? ? ?? ???? ????. ?? ???? ???, ??, ??, ?, ???? ?? ? ??? ?????. ?? ????? ?? ?? ? ? ??? ????? ?? ??? ??? ????. ??, ?? ? ??? ?? ?? ??? ??? ??? ???? ??? ??? ???? ??? ?? ??? ????. ?? ? ????? ??? ???? ? ??? ? ??? TypeofNull? ??? ?????? ??? ? ????. ? ? ?? ??? ???? ?????? ????? ???? ??? ???? ? ??? ? ? ????.

JavaScript Time Object, ??? Google Chrome? EACTEXE, ? ?? ? ???? ?????. JavaScript Time Object, ??? Google Chrome? EACTEXE, ? ?? ? ???? ?????. Jul 08, 2025 pm 02:27 PM

?????, JavaScript ???! ?? ? JavaScript ??? ?? ?? ?????! ?? ?? ??? ??? ??? ? ????. Deno?? Oracle? ?? ??, ??? JavaScript ?? ??? ????, Google Chrome ???? ? ??? ??? ???? ?????. ?????! Deno Oracle? "JavaScript"??? ????? Oracle? ?? ??? ??? ??????. Node.js? Deno? ??? ? Ryan Dahl? ??? ?????? ???? ????? JavaScript? ??? ???? Oracle? ????? ???? ?????.

REACT vs Angular vs Vue : ?? JS ??? ??? ?? ????? REACT vs Angular vs Vue : ?? JS ??? ??? ?? ????? Jul 05, 2025 am 02:24 AM

?? JavaScript ??? ??? ??? ?????? ?? ??? ?? ?? ??? ?? ???? ????. 1. ??? ???? ???? ?? ??? ?? ? ? ???? ??? ??? ?? ? ?? ????? ?????. 2. Angular? ?????? ??? ?? ???? ? ?? ?? ??? ??? ??? ???? ?????. 3. VUE? ???? ?? ??? ???? ?? ?? ??? ?????. ?? ?? ?? ??, ? ??, ???? ???? ? SSR? ???? ??? ??? ??? ???? ? ??? ?????. ???, ??? ??? ??? ????? ????. ??? ??? ??? ??? ?? ????.

JavaScript?? ?? ?? ??? (IIFE)? ????? JavaScript?? ?? ?? ??? (IIFE)? ????? Jul 04, 2025 am 02:42 AM

iife (?? invokedfunctionexpression)? ?? ??? ???? ?? ????? ??? ???? ?? ??? ????? ?? ??? ? ?????. ??? ?? ?? ??? ???? ? ?? ??? ??? ?? (function () {/code/}) ();. ?? ???? ??? ?????. 1. ?? ??? ??? ?? ???? ?? ??? ??? ?????. 2. ?? ??? ??? ???? ?? ?? ??? ????. 3. ?? ?? ??? ????? ?? ???? ???????? ?? ? ??. ???? ?? ???? ?? ??? ES6 ??? ??? ??? ?? ? ??? ????? ??? ? ???? ???????.

?? ??? : JavaScript? ??, ?? ?? ? ?? ????? ?? ??? : JavaScript? ??, ?? ?? ? ?? ????? Jul 08, 2025 am 02:40 AM

??? JavaScript?? ??? ??? ?????? ?? ???????. ?? ??, ?? ?? ? ??? ??? ?? ????? ????? ?????. 1. ?? ??? ??? ????? ???? ??. ()? ?? ??? ??? ?????. ?. ()? ?? ??? ?? ??? ??? ?? ? ? ????. 2. ?? ??? .catch ()? ???? ?? ??? ??? ?? ??? ??????, ??? ???? ???? ????? ??? ? ????. 3. Promise.all ()? ?? ????? (?? ?? ?? ? ??????? ??), Promise.Race () (? ?? ??? ?? ?) ? Promise.AllSettled () (?? ??? ???? ??)

?? API? ???? ??? ???? ??? ?????? ?? API? ???? ??? ???? ??? ?????? Jul 08, 2025 am 02:43 AM

Cacheapi? ?????? ?? ???? ??? ???? ???, ?? ??? ??? ?? ???? ? ??? ?? ? ???? ??? ??????. 1. ???? ????, ??? ??, ?? ?? ?? ???? ???? ??? ? ????. 2. ??? ?? ?? ??? ?? ? ? ????. 3. ?? ?? ?? ?? ?? ??? ??? ?? ?????. 4. ??? ???? ?? ?? ???? ?? ?? ?? ?? ?? ???? ?? ?? ??? ??? ? ????. 5. ?? ???? ??, ??? ??? ? ??? ??, ?? ??? ? ?? ???? ???? ???? ? ?? ?????. 6.?? ??? ?? ?? ?? ??, ???? ?? ? HTTP ?? ????? ?????? ???????.

See all articles