我一直在寻找一个类似的问题,但我找不到和我有同样问题的人。
我正在使用XAMPPV3.2.2。我只需输入我的笔记本电脑IPV4地址,然后输入/index.php/controller/id
(因为我正在使用Codeigniter框架),我就可以通过Chrome (它与我的笔记本电脑连接在同一个网络上)访问我的Android手机。所以我Android手机的Chrome网址是这样的:
192.168.xx.xx/index.php/主体/索引
在这一点上,我可以访问主体和管理网页(背景图像被加载,并引导和css) 这就是它的样子。但这是一些问题开始出现的地方。
其中之一是主网页中的图像没有加载。正如我所说,背景图像加载没有任何问题,但画廊的图像没有加载。
当我试图在管理员的网页中使用一些功能时,会出现另一个问题,比如“删除照片”或“上传图片”。当y按submit按钮时,例如“上传图像”表单(这里是html):
<form action="http://localhost/index.php/principal/subir_foto" enctype="multipart/form-data" method="post" accept-charset="utf-8">
<label class='control-label'>Seleccionar:</label>
<input id="img" required="true" type='file' name='imagen'/>
<div class='input-group'>
<label class='control-label'>Descripción:</label>
<input type='text' name='alt' placeholder='Descripción'>
</div>
<div class='input-group'>
<input type='submit' name='agregar' value="Agregar">
</div>
</form>
我的代码只是为了说明,它在我的笔记本电脑工作很好,我可以上传照片,删除它们,创建新的类别,等等。但是正如我之前所说的,当我尝试在我的手机上做那些事情并按下提交按钮时,浏览器会显示这个页面-> 错误页。
所以,我希望有人有同样的问题,可以给我一个解决办法。
谢谢
发布于 2017-07-06 09:59:31
我终于解决了这个问题..。
在Codeigniter Config.php文件中,我更改:
从…
$config['base_url'] = 'http://localhost/';
至
$localIP = getHostByName(getHostName());
$config['base_url'] = 'http://'.$localIP.'/';
所以现在我要动态地给CodeIgniter服务器IP,现在移动设备可以从服务器IP中搜索图像,而不是像以前使用"localhost“那样搜索来自自己的图像。
https://stackoverflow.com/questions/44805758
复制相似问题