小编use*_*153的帖子

动态设置laravel jwt的到期时间

嗨,我在前端使用角度js,在后端使用带有tymon jwt库的卫星和laravel.我正在使用jwt身份验证.我想在我的网络应用程序中记住我的功能.我看到'ttl'在laravel'config/jwt.php中设置令牌的到期时间.

 /*
|--------------------------------------------------------------------------
| JWT time to live
|--------------------------------------------------------------------------
|
| Specify the length of time (in minutes) that the token will be valid for.
| Defaults to 1 hour
|
*/

'ttl' => 60,
Run Code Online (Sandbox Code Playgroud)

默认情况下,它将是1小时.但是如果用户点击在登录时记住我,我想动态地将其更改为1周.我该如何动态更改它.谢谢.

php jwt angularjs laravel-5

6
推荐指数
5
解决办法
2万
查看次数

使用 JavaScript 添加 JSON-LD

我正在尝试使用 JSON-LD 实现结构数据。我正在做的是使用 jQuery 动态获取内容并制作 JSON 格式并附加到head元素内。

<script id="dynamicJSONLD"></script>
Run Code Online (Sandbox Code Playgroud)
$(document).ready(function(){
var product_name = $(.product-pg .product-name).text();
data = {
               "@context": "https://schema.org",
               "@type": "Product",
               "url": "https://www.example.com/productone",
               "name": product_name  
            };

//creating the script element and storing the JSON-LD

var script = document.createElement('script');
script.type = "application/ld+json";
script.innerHTML = JSON.stringify(data);
document.getElementsByTagName('head')[0].appendChild(script);

//OR

//storing the JSON-LD using ID
$("#dynamicJSONLD").html(JSON.stringify(data));
});
Run Code Online (Sandbox Code Playgroud)

两种方式(创建script元素并存储 JSON-LD / 使用 ID 存储 JSON-LD)都有效吗?哪种实现方式最好?另外,谷歌是否像上面一样使用 JavaScript 抓取动态添加的 JSON-LD?

javascript json-ld

5
推荐指数
1
解决办法
5175
查看次数

"无法打开WampServer的配置文件,请更改index.php文件中的路径",而不是在浏览器中打开localhost

最近我一直在为我的项目使用WAMP服务器.但由于某种原因我需要切换到XAAMP服务器,所以我卸载了WAMP服务器并安装了XAAMP服务器.

但是当我在浏览器中打开localhost时,它说:

无法打开WampServer的配置文件,请更改index.php文件中的路径

可能是什么问题?

xampp

2
推荐指数
1
解决办法
1万
查看次数

React PerfectScrollBar 在容器底部滚动以动态生成内容

我正在使用 React PerfectScrollbar https://www.npmjs.com/package/react-perfect-scrollbar

我正在尝试实现聊天功能,点击用户后,通过 ajax 请求聊天消息并将其放置在 DOM 中。在这里,我希望容器在底部滚动。

我已经在 React 中实现了下面的代码,但它似乎不起作用。蚂蚁的想法?注意:我已经过滤了代码,只粘贴了相关部分。我已经使用了建议的滚动顶部方法,但它不起作用。

 class Complain extends Component {
    constructor(props) {
        super(props);
        
        this.chatContainerRef = React.createRef();

    }
    
        viewComplain(e, id, name) {
        axios.get('/complain/' + id, {

        })
            .then(res => {
                const chatmsg = res.data.data;
                // let data = { msgdata: chatmsg, name: name, complainid: id };
                this.setState({ chatmsg: chatmsg });
                this.setState({ complainname: name });
                this.setState({ activeChat: id });
                this.setState({ complainRegNo: chatmsg[0].regno });
                console.log(this.chatContainerRef);
                this.chatContainerRef.current.scrollTop = 200;  // -> this is not working
            })
            .catch(function …
Run Code Online (Sandbox Code Playgroud)

html javascript reactjs perfect-scrollbar

2
推荐指数
1
解决办法
6824
查看次数

Laravel 安装在子文件夹和地平线中不起作用

我已将 Laravel 安装在子文件夹中,并正在尝试安装 Horizo​​n。路由到“test.com/sub-folder/horizo​​n”后,所有损坏的设计以及内部链接都指向主域而不是主域无子文件夹。

经过搜索,这似乎是已知问题,github问题中已经报告了

当 Laravel 安装在子文件夹中时,是否有任何解决方法可以使 Horizo​​n 工作?

laravel laravel-horizon

2
推荐指数
1
解决办法
1441
查看次数