我在linux中使用托管并在我的Apache2服务器网站中配置子域.我正在使用laravel但默认情况下我没有使用apache2服务.我正在使用laravel artisan命令.
php artisan serve --host 0.0.0.0
它将侦听端口8000.因此,为了访问我的网站,我使用http:// myipaddress:8000来访问它.
我试图"chmod 755或777公共文件夹"但仍然无法正常工作.我的.htaccess在laravel/public文件夹中
的.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Run Code Online (Sandbox Code Playgroud)
当我使用端口8000访问我的网站时,下面是我的错误:
PHP Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
PHP Fatal error: Unknown: Failed opening required 'server.php' (include_path='.:/usr/share/php:/usr/share/php/PEAR') in Unknown on line 0
Run Code Online (Sandbox Code Playgroud) 我在Laravel中使用AJAX创建了按钮.当我点击跟随时,它会随着id的变化而变成unfollow.我试图再次点击取消关注按钮,它没有在点击功能上执行取消关注,但保留了之前的点击功能.
HTML
<a id="followAnchor" type="submit" class="btn btn-info" /><i class="fa icon-user-follow"></i> Follow</a>
</div>
Run Code Online (Sandbox Code Playgroud)
AJAX
$('#followAnchor').on("click", function(e){
var followId = document.getElementById('followAnchor');
$.ajax({
url: "{{ URL::route('follow-post') }}",
type: 'POST',
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
}).done(function(response) {
if(response.errors)
{
}
else if (response.success){
followId.innerHTML = "<i class='fa icon-user-follow'></i>" + "Unfollow";
document.getElementById('followAnchor').id = 'unfollowAnchor';
}
});
}
$('#unfollowAnchor').on("click", function(e){
var unfollowId = document.getElementById('unfollowAnchor');
$.ajax({
url: "{{ URL::route('unfollow-post') }}",
type: 'POST',
data: JSON.stringify(arr),
contentType: 'application/json; charset=utf-8',
dataType: 'json',
}).done(function(response) {
if(response.errors)
{
}
else …Run Code Online (Sandbox Code Playgroud)