admin 发表于 2023-2-16 18:55:02

API单独接口开发在tp5.1上

<div id="article_content" class="article_content clearfix">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/kdoc_html_views-1a98987dfd.css">
      <link rel="stylesheet" href="https://csdnimg.cn/release/blogv2/dist/mdeditor/css/editerView/ck_htmledit_views-6e43165c0a.css">
                <div id="content_views" class="htmledit_views">
                  <p>1.打开FTP&#xff0c;在FTP中把帐号密码添加记录下</p>
<p></p>
<p>2.用phpstorm创建一个项目使用&#xff1a;</p>
<p>在项目中使用</p>
<pre><code>composer create-project topthink/think&#61;5.1.* tp5</code></pre>
<p>将文件包&#xff0c;下载下来。</p>
<p>在phpstrom中这边配置好ftp的相关信息</p>
<p></p>
<p>创建一个模型model</p>
<p>使用php think make:model ArticleModel  将模型创建成功</p>
<p>在模型里面输入相关信息</p>
<p>写入收保护的方法</p>
<p>protected $table &#61;'article';</p>
<p>protected $autoWriteTimestamp &#61; true;</p>
<p></p>
<p></p>
<p>在拿到对应接口的数据最后是这样输出的</p>
<p></p>
<p><span style="color:#fe2c24;">注&#xff1a;对于这样&#xff0c;我们返回的数据接口都是json</span></p>
<p></p>
<p> </p>
<p></p>
<p></p>
<p> </p>
<p> </p>
<p></p>
                </div>
      </div>
      <div id="treeSkill"></div>
页: [1]
查看完整版本: API单独接口开发在tp5.1上