次のコード行:
var sid = $cookieStore.get('PHPSESSID');
このエラーをスローしています:
SyntaxError: Unexpected token m
at Object.parse (native)
at Object.fromJson (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:779:14)
at Object.angular.module.factory.factory.get (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular-cookies.js:149:34)
at Object.getAllImages (https://7-september.com/photoslide/js/services.js:29:36)
at new Management (https://7-september.com/photoslide/js/controllers.js:54:18)
at invoke (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:2902:28)
at Object.instantiate (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:2914:23)
at $get (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:4805:24)
at update (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:14198:26)
at Object.$get.Scope.$broadcast (https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js:8307:28)
そこで、angular.js の 779 行目にブレークポイントを設定しました。コードは次のとおりです。
777 function fromJson(json) {
778 return isString(json)
779 ? JSON.parse(json)
780 : json;
781 }
json
渡される値JSON.parse()
は「mnp801fap6kor50trgv4cgk7m2」です。
また、そのメソッドに渡される他のものは、通常、""userName"" のように 2 つの引用符で囲まれていることに気付きました。
助けてください。私はこれに対して数時間頭をぶつけています。
または、誰かが Angular を使用して Cookie から php セッション ID を取得するより良い方法を知っていれば、それも素晴らしいでしょう。(はい、jQuery またはベアメタル JS を使用して実行できますが、Angular を引き続き使用したいと思います)。
前もって感謝します!!!