我想从我的Json结果中删除所有“\”。
我的Json结果是:
$results = $pdo->prepare("SELECT * FROM clients WHERE id=?");
$results->execute([$_GET['client']]);
foreach ( $results as $data ){
echo $data->name;
}
我已尝试使用 $scope.ContactList = [{"User":{"Country":{"CountryID":"US","CountryIDISO3":"USA","CountryOrder":999,"CountryName":"UNITED STATES","CountryISDCode":null,"ContinentCode":"NA","CreatedBy":"admin@gpsonline.com","CreatedOn":"2016-07-01T00:00:00","ModifiedBy":null,"ModifiedOn":null},"UserID":100001,"UserType":"US","UserEmail":"user@gp.com","UserPassword":"12345","UserPhone":"5587452036","FirstName":"Userupdate","LastName":"Testupdate","Address":"","Company":"","WorkPhone":"","Gender":"M","DateOfBirth":"1986-02-10T00:00:00","CountryID":"US","VerifiedPIN":null,"VerifiedEmail":"N","Signature":null,"isSignup":null,"PageCount":0,"CreatedBy":null,"CreatedOn":null,"ModifiedBy":null,"ModifiedOn":null},"UserContactUser":null,"UserContactID":3,"UserID":100001,"UserContactName":"Palash","UserContactPhone":"6520189650","UserContactEmail":"s@c.com","InviteSent":"N","InviteAccepted":"N","InviteAcceptedOn":null,"InviteRejected":"N","InviteRejectedOn":null,"InviteRemoved":"N","InviteRemovedOn":null,"UserContactUserID":0,"UserGroupList":"[{\"User\":{\"Country\":{\"CountryID\":\"US\",\"CountryIDISO3\":\"USA\",\"CountryOrder\":999,\"CountryName\":\"UNITED STATES\",\"CountryISDCode\":null,\"ContinentCode\":\"NA\",\"CreatedBy\":\"admin@gpsonline.com\",\"CreatedOn\":\"2016-07-01T00:00:00\",\"ModifiedBy\":null,\"ModifiedOn\":null},\"UserID\":100001.0,\"UserType\":\"US\",\"UserEmail\":\"user@gp.com\",\"UserPassword\":\"12345\",\"UserPhone\":\"5587452036\",\"FirstName\":\"Userupdate\",\"LastName\":\"Testupdate\",\"Address\":\"\",\"Company\":\"\",\"WorkPhone\":\"\",\"Gender\":\"M\",\"DateOfBirth\":\"1986-02-10T00:00:00\",\"CountryID\":\"US\",\"VerifiedPIN\":null,\"VerifiedEmail\":\"N\",\"Signature\":null,\"isSignup\":null,\"PageCount\":0,\"CreatedBy\":null,\"CreatedOn\":null,\"ModifiedBy\":null,\"ModifiedOn\":null},\"UserGroupID\":1.0,\"UserGroupOwnerID\":100001.0,\"UserGroupOwnerName\":null,\"UserGroupOwnerEmail\":null,\"UserGroupOwnerPhone\":null,\"UserGroupName\":\"test\",\"UserGroupDescription\":\"test\",\"UserGroupIcon\":null,\"UserGroupActive\":null,\"PageCount\":null}]
选项但替换它的对象已从json更改为string。
和JSON.stringify($scope.ContactList).replace(/\\/g, "")
但也没有为我工作