| phprpc_client.create = function (name, encrypt) { eval([name, ‘ = new phprpc_client();’, name, ‘.__name = “‘, name, ‘”;’].join(”)); if (typeof(encrypt) == “boolean”) { encrypt = true; eval([name, ‘.__encrypt = ‘, encrypt, ‘;’].join(”)); } } 2.1如此,3.0似乎也没什么改观 这个方法写得实在让人倒胃 评论 作者 naspy — 2006-08-21 @ 17:20:38 2 楼这样做也是不得已,不然无法获得创建的对象名,以至于后面的操作无法完成。 如果你有更好的办法,欢迎提出来。 评论 作者 andot — 2006-08-21 @ 17:43:53 3 楼phprpc_client.__clientList = []; phprpc_client.create = function (encrypt) { var client_id = this.__clientList.length; var client = new phprpc_client(); this.__clientList[client_id] = client; client.__name = ‘phprpc_client.__clientList[’ client_id ’]'; if (encrypt) { client.__encrypt = true; } return client; } 评论 作者 naspy — 2006-08 |
| |