Home >Backend Development >PHP Tutorial >搞前端的,请问一个简单php有关问题

搞前端的,请问一个简单php有关问题

WBOY
WBOYOriginal
2016-06-13 10:29:13709browse

搞前端的,请教一个简单php问题
$MySQLConnection = mysql_connect( "192.168.22.1", "root", "123456" );
@mysql_select_db( "first");
$Result = mysql_query("INSERT INTO `first`.`biao` (`hao`) VALUES ('$xingming');"); 

在我自己的页面写这个,是不是可以控制往192.168.22.1的first数据库里写东西, 这在php里面叫跨域吗? 192.168.22.1怎样防止这样的操作啊?


------解决方案--------------------
php 不存在跨域问题

mysql 默认只开放本地访问服务(127.0.0.1)
即便 192.168.22.1 就是本地ip地址,未经授权也不可访问
------解决方案--------------------
跨域是说AJAX跨域,这里没有跨域问题。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn