串(16)转换为INT(1)例如如何在PHP
<div ng-repeat = 'list in lists'>
<?php
$user_post_id = "{{list.user.id}}"; //this syntax works
var_dump($user_post_id); // gives String(16) '1'
$user_post_int_id = (int)$user_post_id; // change from string to int
var_dump($user_post_int_id); // gives int(1) 0, I don't know why isn't type conversion working!
echo $user_post_id; // echoes out 1
echo $user_post_int_id; //echoes out the 0
所以,我认为主要的问题是转换的类型,因为我想一两件事,其中字符串(1)转换到int(1)没有问题,但用字符串(16),所有东西都吹散,结果为0.
这可能有所帮助https://scotch.io/tutorials/quick-tip-using-laravel-blade-with-angularjs –