簡體   English   中英

使用 php 和 axios 反應本機連接到本地數據庫

[英]React native connect to local database with php and axios

我在通過 PHP 將前端連接到后端時遇到問題。 數據庫連接到 PHP 但不是前端,當我在 Postman 上運行它時,它會打印出 500 internal server error。

    axios
      .get(Api, {
        params: {
          route: "extension/account/purpletree_multivendor/api/sellers",
          language_id: this.props.language,
          search_text: this.state.searchTxt.toUpperCase(),
          category_id: categoryId.toString(),
          geocode: geocode,
        },
        headers: {
          'Content-Type': 'application/json',
        },
      })
      .then((res) => {
        //handle no seach item
        if (res.data.success) {
          if (res.data.message !== "No Data") {
            this.setState({
              sellers: res.data.data.sellers,
              isLoading: false,
            });
          } else {
            this.setState({ isLoading: false, showMessage: true });
          }
        } else {
          //show error message
          this.setState({ isLoading: false });
        }
      });

感謝您回答這個問題,我問了我的一位導師並想通了:

  1. 我沒有打開 php.ini 中的display_errors
  2. 打開它后,它會打印出詳細的錯誤,這是我的一些數據庫表丟失了,所以它無法運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM