사용자가 내 전화 응용 프로그램에서 로그인 할 수 있도록 사용자 지정 '계정 만들기'스크립트를 만들었습니다.URL을 통한 사용자 지정 계정 작성 스크립트에서 강제 언어 변경
내가 원하는 것은 해당 로캘에 따라 서버에서 응답을 변경할 수 있습니다. 내가 페이지를 요청할 때 그래서 추가 할 LANG = EN 또는 LANG =에서 zh 등
이 http://mysite.com/phone/my_custom_account_creation.php?lang=en
응답
작동합니다
<resource classification="error" code="Error (Code: 500)"> <message>Please enter your name:</message> </resource>
이 작동하지 않습니다 :
http://mysite.com/phone/my_custom_account_creation.php?lang=zh
응답 : 나는 중국어로 설정에서 줌라으로 기본 언어를 가면
<resource classification="error" code="Error (Code: 500)"> <message>Please enter your name:</message> </resource>
, 그것은 작동합니다.
http://mysite.com/phone/my_custom_account_creation.php?lang=en 이 작동하지 않습니다
<resource classification="error" code="Error (Code: 500)"> <message>请输入您的姓名。</message> </resource>
하지만
대신 그것은 중국어 버전을 표시하고 있습니다.여기에서 수행 할 수있는 작업은 무엇입니까? 여기
내가 등록을 위해 사용하고있는 코드입니다 :<?php header ("content-type: text/xml"); /* * Register a user from a phone interface using JAVA */ define('_JEXEC', 1); //define('JPATH_BASE', dirname(__FILE__));//this is when we are in the root define('JPATH_BASE', dirname(__FILE__)."/../..");//this is when we are in the root define('DS', DIRECTORY_SEPARATOR); require_once (JPATH_BASE .DS.'includes'.DS.'defines.php'); require_once (JPATH_BASE .DS.'includes'.DS.'framework.php'); //My functions require_once('../shared_functions.php'); $mainframe =& JFactory::getApplication('site'); $mainframe->initialise(); //Don't use tokens for registration //JRequest::checkToken() or jexit('Invalid Token'); $user = clone(JFactory::getUser()); $pathway = & $mainframe->getPathway(); $config = & JFactory::getConfig(); $authorize = & JFactory::getACL(); $document = & JFactory::getDocument(); $usersConfig = &JComponentHelper::getParams('com_users'); if ($usersConfig->get('allowUserRegistration') == '0') { xmlError("Access Forbidden (Code 403)","Registration has been temporarily disabled"); //JError::raiseError(403, JText::_('Access Forbidden')); return; } $newUsertype = $usersConfig->get('new_usertype'); if (!$newUsertype) { $newUsertype = 'Registered'; } if (!$user->bind(JRequest::get('post'), 'usertype')) { xmlError("Error (Code: 500)",$user->getError()); return; //JError::raiseError(500, $user->getError()); } $user->set('id', 0); $user->set('usertype', ''); $user->set('gid', $authorize->get_group_id('', $newUsertype, 'ARO')); $date =& JFactory::getDate(); $user->set('registerDate', $date->toMySQL()); $useractivation = $usersConfig->get('useractivation'); if ($useractivation == '1') { jimport('joomla.user.helper'); $user->set('activation', md5(JUserHelper::genRandomPassword())); $user->set('block', '1'); } if (!$user->save()) { // if the user is NOT saved... xmlError("Error (Code: 500)",$user->getError()); //JError::raiseWarning('', JText::_($user->getError())); // ...raise an Warning //return false; // if you're in a method/function return false } xmlMessage("ok",CODE_ACCOUNT_CREATED,"Success"); ?>