###前提・実現したいこと
Unityでのサーバー通信を試しております。
サーバーはさくらレンタルサーバーを利用しております。
CodeIgniter3をインストールしてさくらファイルマネージャーの任意の場所に置き、
ユーザーガイドを観ながら実装していったのですがいざ通信の際になると404エラーが出てしまいます。
サーバー側の階層
さくらURL
-api (CodeIgniter3フォルダの名前を変えた)
--application
---controllers
----User.php (自分が作ったファイル)
---models
----UserCreate.php (自分が作ったファイル)
.htaccessファイルの描き方については以下のサイトを参考にしました
http://keneffc.hatenablog.com/entry/2015/08/05/140542
###発生している問題・エラーメッセージ
404エラー
エラーメッセージ
###該当のソースコード
php
1<?php 2 3class User extends CI_Controller 4{ 5 public function create() 6 { 7 $this->load->model('createuser', 'creator'); 8 9 $post_data = $this->input->post(); 10 $this->creator->create($post_data); 11 } 12}
php
1<?php 2class CreateUser extends CI_Model 3 { 4 public function __construct() 5 { 6 parent::__construct(); 7 } 8 9 public function create($post_data) 10 { 11 $this->load->database(); 12 13 $id = uniqid(); 14 $name= $post_data['user_name']; 15 16 $data = array( 17 'id' => $id, 18 'name' => $name, 19 ); 20 21 $query = $this->db->insert("user", $data); 22 } 23}
php
1.htaccess 2 3RewriteEngine on 4 5RewriteCond $1 !^(index\.php|.+\.css$|.+\.js$|.+\.png$|.+\.jpg$|robots\.txt) 6RewriteRule ^(.*)$ /api/index.php?$1 [L] 7 8<IfModule authz_core_module> 9Require all denied 10</IfModule> 11<IfModule !authz_core_module> 12Deny from all 13</IfModule>
php
1config.php 2 3/* 4|-------------------------------------------------------------------------- 5| Base Site URL 6|-------------------------------------------------------------------------- 7| 8| URL to your CodeIgniter root. Typically this will be your base URL, 9| WITH a trailing slash: 10| 11| http://example.com/ 12| 13| WARNING: You MUST set this value! 14| 15| If it is not set, then CodeIgniter will try guess the protocol and path 16| your installation, but due to security concerns the hostname will be set 17| to $_SERVER['SERVER_ADDR'] if available, or localhost otherwise. 18| The auto-detection mechanism exists only for convenience during 19| development and MUST NOT be used in production! 20| 21| If you need to allow multiple domains, remember that this file is still 22| a PHP script and you can easily do that on your own. 23| 24*/ 25$config['base_url'] = 'http://testtest.sakura.ne.jp/api/'; 26 27/* 28|-------------------------------------------------------------------------- 29| Index File 30|-------------------------------------------------------------------------- 31| 32| Typically this will be your index.php file, unless you've renamed it to 33| something else. If you are using mod_rewrite to remove the page set this 34| variable so that it is blank. 35| 36*/ 37$config['index_page'] = '';
###試したこと
Unity側からのUrlの変更
http://testtest.sakura.ne.jp/api/user/create
http://testtest.sakura.ne.jp/api/User/create
両方ともだめでした。
###補足情報(言語/FW/ツール等のバージョンなど)
より詳細な情報
さくらサーバーがわでの操作やPHP、CodeIgniter3での操作で足りないところなどがあれば教えていただきたいです、
よろしくお願いします。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/05/15 17:25
退会済みユーザー
2017/05/15 22:02